Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java	(revision 31491)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java	(revision 31492)
@@ -17,4 +17,5 @@
 import javax.swing.JSeparator;
 import javax.swing.JTree;
+import javax.swing.SwingUtilities;
 import javax.swing.tree.DefaultTreeCellRenderer;
 import javax.swing.tree.DefaultTreeModel;
@@ -80,8 +81,11 @@
     treesPanel.add(this.spacer, GBC.eol());
     this.spacer.setVisible(false);
-    treesPanel.add(this.undoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
+    treesPanel
+        .add(this.undoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     this.separator.setVisible(false);
-    treesPanel.add(this.separator, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
-    treesPanel.add(this.redoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
+    treesPanel.add(this.separator, GBC.eol()
+        .fill(GridBagConstraints.HORIZONTAL));
+    treesPanel
+        .add(this.redoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     treesPanel.add(Box.createRigidArea(new Dimension(0, 0)),
         GBC.std().weight(0, 1));
@@ -135,5 +139,6 @@
     }
 
-    this.separator.setVisible(!undoCommands.isEmpty() || !redoCommands.isEmpty());
+    this.separator.setVisible(!undoCommands.isEmpty()
+        || !redoCommands.isEmpty());
     this.spacer.setVisible(undoCommands.isEmpty() && !redoCommands.isEmpty());
 
@@ -144,5 +149,14 @@
   @Override
   public void recordChanged() {
-    buildTree();
+    if (!SwingUtilities.isEventDispatchThread()) {
+      SwingUtilities.invokeLater(new Runnable() {
+        @Override
+        public void run() {
+          recordChanged();
+        }
+      });
+    } else {
+      buildTree();
+    }
   }
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java	(revision 31491)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java	(revision 31492)
@@ -2,6 +2,4 @@
 
 import java.util.ArrayList;
-
-import javax.swing.SwingUtilities;
 
 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage;
@@ -73,39 +71,31 @@
    */
   public void addCommand(final MapillaryCommand command) {
-    if (!SwingUtilities.isEventDispatchThread()) {
-      SwingUtilities.invokeLater(new Runnable() {
-        @Override
-        public void run() {
-          addCommand(command);
-        }
-      });
-    } else {
-      if (command instanceof MapillaryExecutableCommand)
-        ((MapillaryExecutableCommand) command).execute();
-      // Checks if it is a continuation of last command
-      if (this.position != -1) {
-        boolean equalSets = true;
-        for (MapillaryAbstractImage img : this.commandList.get(this.position).images)
-          if (!command.images.contains(img))
-            equalSets = false;
-        for (MapillaryAbstractImage img : command.images)
-          if (!this.commandList.get(this.position).images.contains(img))
-            equalSets = false;
-        if (equalSets
-            && this.commandList.get(this.position).getClass() == command
-                .getClass()) {
-          this.commandList.get(this.position).sum(command);
-          fireRecordChanged();
-          return;
-        }
+
+    if (command instanceof MapillaryExecutableCommand)
+      ((MapillaryExecutableCommand) command).execute();
+    // Checks if it is a continuation of last command
+    if (this.position != -1) {
+      boolean equalSets = true;
+      for (MapillaryAbstractImage img : this.commandList.get(this.position).images)
+        if (!command.images.contains(img))
+          equalSets = false;
+      for (MapillaryAbstractImage img : command.images)
+        if (!this.commandList.get(this.position).images.contains(img))
+          equalSets = false;
+      if (equalSets
+          && this.commandList.get(this.position).getClass() == command
+              .getClass()) {
+        this.commandList.get(this.position).sum(command);
+        fireRecordChanged();
+        return;
       }
-      // Adds the command to the last position of the list.
-      this.commandList.add(this.position + 1, command);
-      this.position++;
-      while (this.commandList.size() > this.position + 1) {
-        this.commandList.remove(this.position + 1);
-      }
-      fireRecordChanged();
     }
+    // Adds the command to the last position of the list.
+    this.commandList.add(this.position + 1, command);
+    this.position++;
+    while (this.commandList.size() > this.position + 1) {
+      this.commandList.remove(this.position + 1);
+    }
+    fireRecordChanged();
   }
 
