Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31840)
@@ -477,7 +477,9 @@
       if (image.getLatLon().greatCircleDistance(selectedCoords) < SEQUENCE_MAX_JUMP_DISTANCE
           && selected.getSequence() != image.getSequence()) {
-        if ((ret[0] == null && ret[1] == null)
-            || (image.getLatLon().greatCircleDistance(selectedCoords) < distances[0] && (ret[1] == null || image
-                .getSequence() != ret[1].getSequence()))) {
+        if (
+            ret[0] == null && ret[1] == null
+            || image.getLatLon().greatCircleDistance(selectedCoords) < distances[0]
+            && (ret[1] == null || image.getSequence() != ret[1].getSequence())
+        ) {
           ret[0] = image;
           distances[0] = image.getLatLon().greatCircleDistance(selectedCoords);
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java	(revision 31840)
@@ -28,8 +28,13 @@
    */
   public MapillaryDownloadAction() {
-    super(tr("Mapillary"), MapillaryPlugin.getProvider("icon24.png"),
-        tr("Create Mapillary layer"), Shortcut.registerShortcut("Mapillary",
-            tr("Start Mapillary layer"), KeyEvent.VK_COMMA, Shortcut.SHIFT),
-        false, "mapillaryDownload", false);
+    super(
+        tr("Mapillary"),
+        MapillaryPlugin.getProvider("icon24.png"),
+        tr("Create Mapillary layer"),
+        Shortcut.registerShortcut("Mapillary", tr("Start Mapillary layer"), KeyEvent.VK_COMMA, Shortcut.SHIFT),
+        false,
+        "mapillaryDownload",
+        false
+    );
     this.setEnabled(false);
   }
@@ -38,8 +43,9 @@
   public void actionPerformed(ActionEvent arg0) {
     MapillaryLayer.getInstance();
-    if (Main.map.mapView.getActiveLayer() != MapillaryLayer.getInstance())
+    if (Main.map.mapView.getActiveLayer() == MapillaryLayer.getInstance()) {
+      Main.map.mapView.setActiveLayer(Main.map.mapView.getEditLayer());
+    } else {
       Main.map.mapView.setActiveLayer(MapillaryLayer.getInstance());
-    else
-      Main.map.mapView.setActiveLayer(Main.map.mapView.getEditLayer());
+    }
   }
 }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java	(revision 31840)
@@ -80,6 +80,7 @@
             if (!images.contains(image))
               images.addAll(((MapillaryImage) image).getSequence().getImages());
-          } else
+          } else {
             images.add(image);
+          }
         export(images);
       } else if (this.dialog.group.isSelected(this.dialog.selected.getModel())) {
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java	(revision 31840)
@@ -39,8 +39,16 @@
    */
   public MapillaryImportAction() {
-    super(tr("Import pictures"), MapillaryPlugin.getProvider("icon24.png"),
-        tr("Import local pictures"), Shortcut.registerShortcut(
-            "Import Mapillary", tr("Import pictures into Mapillary layer"),
-            KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), false, "mapillaryImport",
+    super(
+        tr("Import pictures"),
+        MapillaryPlugin.getProvider("icon24.png"),
+        tr("Import local pictures"),
+        Shortcut.registerShortcut(
+            "Import Mapillary",
+            tr("Import pictures into Mapillary layer"),
+            KeyEvent.CHAR_UNDEFINED,
+            Shortcut.NONE
+        ),
+        false,
+        "mapillaryImport",
         false);
     this.setEnabled(false);
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/CacheUtils.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/CacheUtils.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/CacheUtils.java	(revision 31840)
@@ -63,4 +63,5 @@
         break;
       case FULL_IMAGE:
+      default:
         submit(img.getKey(), MapillaryCache.Type.FULL_IMAGE, ignoreDownload);
         break;
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 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java	(revision 31840)
@@ -132,5 +132,5 @@
    * @return The unique instance of the class.
    */
-  public static MapillaryHistoryDialog getInstance() {
+  public static synchronized MapillaryHistoryDialog getInstance() {
     if (instance == null)
       instance = new MapillaryHistoryDialog();
@@ -229,8 +229,8 @@
 
     @Override
-    public Component getTreeCellRendererComponent(JTree tree, Object value,
-        boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
-      super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row,
-          hasFocus);
+    public Component getTreeCellRendererComponent(
+        JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus
+    ) {
+      super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
       setIcon(ImageProvider.get("data/node.png"));
       return this;
@@ -249,12 +249,15 @@
     @Override
     public void mouseClicked(MouseEvent e) {
+      // Method is enforced by MouseListener, but (currently) not needed
     }
 
     @Override
     public void mouseEntered(MouseEvent e) {
+      // Method is enforced by MouseListener, but (currently) not needed
     }
 
     @Override
     public void mouseExited(MouseEvent e) {
+      // Method is enforced by MouseListener, but (currently) not needed
     }
 
@@ -262,14 +265,12 @@
     public void mousePressed(MouseEvent e) {
       if (e.getClickCount() == 2) {
-        if (MapillaryHistoryDialog.this.undoTree.getSelectionPath() != null) {
-          MapillaryCommand cmd = MapillaryHistoryDialog.this.map
-              .get(MapillaryHistoryDialog.this.undoTree.getSelectionPath()
-                  .getLastPathComponent());
-          if (!(cmd instanceof CommandDelete))
+        if (undoTree.getSelectionPath() == null) {
+          MapillaryUtils.showPictures(map.get(redoTree.getSelectionPath().getLastPathComponent()).images, true);
+        } else {
+          MapillaryCommand cmd = map.get(undoTree.getSelectionPath().getLastPathComponent());
+          if (!(cmd instanceof CommandDelete)) {
             MapillaryUtils.showPictures(cmd.images, true);
-        } else
-          MapillaryUtils.showPictures(MapillaryHistoryDialog.this.map
-              .get(MapillaryHistoryDialog.this.redoTree.getSelectionPath()
-                  .getLastPathComponent()).images, true);
+          }
+        }
       }
     }
@@ -277,4 +278,5 @@
     @Override
     public void mouseReleased(MouseEvent e) {
+      // Method is enforced by MouseListener, but (currently) not needed
     }
   }
@@ -284,5 +286,5 @@
     private JTree source;
 
-    private UndoRedoSelectionListener(JTree source) {
+    protected UndoRedoSelectionListener(JTree source) {
       this.source = source;
     }
@@ -290,21 +292,13 @@
     @Override
     public void valueChanged(TreeSelectionEvent e) {
-      if (this.source == MapillaryHistoryDialog.this.undoTree) {
-        MapillaryHistoryDialog.this.redoTree.getSelectionModel()
-            .removeTreeSelectionListener(
-                MapillaryHistoryDialog.this.redoSelectionListener);
-        MapillaryHistoryDialog.this.redoTree.clearSelection();
-        MapillaryHistoryDialog.this.redoTree.getSelectionModel()
-            .addTreeSelectionListener(
-                MapillaryHistoryDialog.this.redoSelectionListener);
-      }
-      if (this.source == MapillaryHistoryDialog.this.redoTree) {
-        MapillaryHistoryDialog.this.undoTree.getSelectionModel()
-            .removeTreeSelectionListener(
-                MapillaryHistoryDialog.this.undoSelectionListener);
-        MapillaryHistoryDialog.this.undoTree.clearSelection();
-        MapillaryHistoryDialog.this.undoTree.getSelectionModel()
-            .addTreeSelectionListener(
-                MapillaryHistoryDialog.this.undoSelectionListener);
+      if (this.source == undoTree) {
+        redoTree.getSelectionModel().removeTreeSelectionListener(redoSelectionListener);
+        redoTree.clearSelection();
+        redoTree.getSelectionModel().addTreeSelectionListener(redoSelectionListener);
+      }
+      if (this.source == redoTree) {
+        undoTree.getSelectionModel().removeTreeSelectionListener(undoSelectionListener);
+        undoTree.clearSelection();
+        undoTree.getSelectionModel().addTreeSelectionListener(undoSelectionListener);
       }
     }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java	(revision 31840)
@@ -452,5 +452,5 @@
    * @return the part of compRect with the same width/height ratio as the image
    */
-  static Rectangle calculateDrawImageRectangle(Rectangle imgRect, Rectangle compRect) {
+  private static Rectangle calculateDrawImageRectangle(Rectangle imgRect, Rectangle compRect) {
     int x = 0;
     int y = 0;
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandDelete.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandDelete.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandDelete.java	(revision 31840)
@@ -6,4 +6,5 @@
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage;
@@ -18,5 +19,5 @@
 public class CommandDelete extends MapillaryExecutableCommand {
 
-  private final HashMap<MapillaryAbstractImage, Integer> changesHash = new HashMap<>();
+  private final Map<MapillaryAbstractImage, Integer> changesHash = new HashMap<>();
 
   /**
@@ -32,4 +33,5 @@
   @Override
   public void sum(MapillaryCommand command) {
+    // TODO: Implement
   }
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/MapillaryCommand.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/MapillaryCommand.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/MapillaryCommand.java	(revision 31840)
@@ -24,5 +24,5 @@
    */
   public MapillaryCommand(List<MapillaryAbstractImage> images) {
-    this.images = new ArrayList<MapillaryAbstractImage>(images);
+    this.images = new ArrayList<>(images);
   }
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java	(revision 31840)
@@ -5,4 +5,5 @@
 
 import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
@@ -31,9 +32,8 @@
 
   /** All the Threads that have been run. Used to interrupt them properly. */
-  private static ArrayList<Thread> threads = new ArrayList<>();
+  private static List<Thread> threads = new ArrayList<>();
 
   /** Max area to be downloaded */
-  public static final double MAX_AREA = Main.pref.getDouble(
-      "mapillary.max-download-area", 0.015);
+  public static final double MAX_AREA = Main.pref.getDouble("mapillary.max-download-area", 0.015);
 
   /** Executor that will run the petitions. */
@@ -175,11 +175,8 @@
   private static boolean isAreaTooBig() {
     double area = 0;
-    for (Bounds bounds : Main.map.mapView.getEditLayer().data
-        .getDataSourceBounds()) {
+    for (Bounds bounds : Main.map.mapView.getEditLayer().data.getDataSourceBounds()) {
       area += bounds.getArea();
     }
-    if (area > MAX_AREA)
-      return true;
-    return false;
+    return area > MAX_AREA;
   }
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportWriterThread.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportWriterThread.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportWriterThread.java	(revision 31840)
@@ -85,9 +85,9 @@
           String path = ((MapillaryImportedImage) mimg).getFile().getPath();
           finalPath = path.substring(0, path.lastIndexOf('.'));
-        } else if (mimg instanceof MapillaryImage)
-          finalPath = this.path + "/" + ((MapillaryImage) mimg).getKey();
-        else if (mimg instanceof MapillaryImportedImage)
-          finalPath = this.path + "/"
-              + ((MapillaryImportedImage) mimg).getFile().getName();
+        } else if (mimg instanceof MapillaryImage) {
+          finalPath = this.path + '/' + ((MapillaryImage) mimg).getKey();
+        } else if (mimg instanceof MapillaryImportedImage) {
+          finalPath = this.path + '/' + ((MapillaryImportedImage) mimg).getFile().getName();
+        }
 
         // Transforms the image into a byte array.
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java	(revision 31839)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java	(revision 31840)
@@ -60,5 +60,5 @@
     private final UUID uuid;
     private final boolean delete;
-    ThreadPoolExecutor ex;
+    private ThreadPoolExecutor ex;
 
     private SequenceUploadThread(List<MapillaryAbstractImage> images,
