diff --git a/src/main/java/de/prob2/jupyter/commands/DotCommand.java b/src/main/java/de/prob2/jupyter/commands/DotCommand.java
index 07ad6160d8014c86ff79c8de4d3018d3211edde4..ef0554934c81558d4c444641f26a4515a638ad43 100644
--- a/src/main/java/de/prob2/jupyter/commands/DotCommand.java
+++ b/src/main/java/de/prob2/jupyter/commands/DotCommand.java
@@ -101,11 +101,12 @@ public final class DotCommand implements Command {
 		}
 		
 		final Trace trace = this.animationSelector.getCurrentTrace();
-		final DotVisualizationCommand dotCommand = DotVisualizationCommand.getAll(trace.getCurrentState())
-			.stream()
-			.filter(i -> command.equals(i.getCommand()))
-			.findAny()
-			.orElseThrow(() -> new UserErrorException("No such dot command: " + command));
+		final DotVisualizationCommand dotCommand;
+		try {
+			dotCommand = DotVisualizationCommand.getByName(command, trace.getCurrentState());
+		} catch (final IllegalArgumentException e) {
+			throw new UserErrorException("No such dot command: " + command, e);
+		}
 		
 		// Provide source code (if any) to error highlighter
 		final Supplier<String> execute = () -> dotCommand.visualizeAsSvgToString(dotCommandArgs);
diff --git a/src/main/java/de/prob2/jupyter/commands/TableCommand.java b/src/main/java/de/prob2/jupyter/commands/TableCommand.java
index 700da4af1499389a5cdb335dbe6b8d6a3b086069..cc54b696f8ce04a6d7279c89b9296fdfec169275 100644
--- a/src/main/java/de/prob2/jupyter/commands/TableCommand.java
+++ b/src/main/java/de/prob2/jupyter/commands/TableCommand.java
@@ -73,11 +73,7 @@ public final class TableCommand implements Command {
 		final String code = kernel.insertLetVariables(args.get(EXPRESSION_PARAM));
 		final IEvalElement formula = CommandUtils.withSourceCode(code, () -> kernel.parseFormula(code, FormulaExpand.EXPAND));
 		
-		final TableData table = TableVisualizationCommand.getAll(trace.getCurrentState())
-			.stream()
-			.filter(c -> "expr_as_table".equals(c.getCommand()))
-			.findAny()
-			.orElseThrow(AssertionError::new)
+		final TableData table = TableVisualizationCommand.getByName(TableVisualizationCommand.EXPRESSION_AS_TABLE_NAME, trace.getCurrentState())
 			.visualize(Collections.singletonList(formula));
 		
 		final StringBuilder sbPlain = new StringBuilder();