Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31974)
@@ -111,5 +111,5 @@
    * @param lis Listener to be added.
    */
-  public void addListener(MapillaryDataListener lis) {
+  public final void addListener(MapillaryDataListener lis) {
     this.listeners.add(lis);
   }
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 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31974)
@@ -68,5 +68,5 @@
  *
  */
-public class MapillaryLayer extends AbstractModifiableLayer implements
+public final class MapillaryLayer extends AbstractModifiableLayer implements
     DataSetListener, EditLayerChangeListener, LayerChangeListener {
 
@@ -371,9 +371,7 @@
    * Draws the highlight of the icon.
    *
-   * @param g
-   * @param p
-   *          The {@link Point} where the image must be set.
-   * @param size
-   *          The width in pixels of the highlight.
+   * @param g  the graphics context
+   * @param p  the {@link Point} where the image must be set.
+   * @param size  the width in pixels of the highlight.
    */
   private void drawPointHighlight(Graphics2D g, Point p, int size) {
@@ -396,11 +394,8 @@
    * image.
    *
-   * @param g
-   * @param image
-   *          The {@link MapillaryAbstractImage} which is being drown.
-   * @param icon
-   *          The {@link ImageIcon} that represents the image.
-   * @param p
-   *          The P¡{@link Point} when the image lies.
+   * @param g  the graphics context
+   * @param image  The {@link MapillaryAbstractImage} which is being drown.
+   * @param icon  The {@link ImageIcon} that represents the image.
+   * @param p  The P¡{@link Point} when the image lies.
    */
   private void draw(Graphics2D g, MapillaryAbstractImage image, ImageIcon icon, Point p) {
@@ -531,28 +526,35 @@
   @Override
   public void primitivesAdded(PrimitivesAddedEvent event) {
+    // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed.
   }
 
   @Override
   public void primitivesRemoved(PrimitivesRemovedEvent event) {
+    // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed.
   }
 
   @Override
   public void tagsChanged(TagsChangedEvent event) {
+    // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed.
   }
 
   @Override
   public void nodeMoved(NodeMovedEvent event) {
+    // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed.
   }
 
   @Override
   public void wayNodesChanged(WayNodesChangedEvent event) {
+    // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed.
   }
 
   @Override
   public void relationMembersChanged(RelationMembersChangedEvent event) {
+    // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed.
   }
 
   @Override
   public void otherDatasetChange(AbstractDatasetChangedEvent event) {
+    // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed.
   }
 
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java	(revision 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java	(revision 31974)
@@ -8,4 +8,5 @@
 import java.awt.event.KeyEvent;
 import java.util.ArrayList;
+import java.util.List;
 
 import javax.swing.JDialog;
@@ -32,5 +33,5 @@
 
   private WalkThread thread = null;
-  private final ArrayList<WalkListener> listeners = new ArrayList<>();
+  private final List<WalkListener> listeners = new ArrayList<>();
 
   /**
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java	(revision 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java	(revision 31974)
@@ -82,7 +82,7 @@
     this.group.add(this.rewrite);
     // Some options are disabled depending on the circumstances
-    if (MapillaryLayer.getInstance().getData().getSelectedImage() == null
-        || !(MapillaryLayer.getInstance().getData().getSelectedImage() instanceof MapillaryImage && ((MapillaryImage) MapillaryLayer
-            .getInstance().getData().getSelectedImage()).getSequence() != null)) {
+    if (!(MapillaryLayer.getInstance().getData().getSelectedImage() instanceof MapillaryImage)
+        || ((MapillaryImage) MapillaryLayer.getInstance().getData().getSelectedImage()).getSequence() == null
+    ) {
       this.sequence.setEnabled(false);
     }
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 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java	(revision 31974)
@@ -14,4 +14,5 @@
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -141,5 +142,5 @@
     this.redoButton.setEnabled(true);
     this.undoButton.setEnabled(true);
-    ArrayList<MapillaryCommand> commands = MapillaryRecord.getInstance().commandList;
+    List<MapillaryCommand> commands = MapillaryRecord.getInstance().commandList;
     int position = MapillaryRecord.getInstance().position;
     ArrayList<MapillaryCommand> undoCommands = new ArrayList<>();
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 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java	(revision 31974)
@@ -3,4 +3,5 @@
 
 import java.util.ArrayList;
+import java.util.List;
 
 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage;
@@ -18,8 +19,8 @@
   private static MapillaryRecord instance;
 
-  private final ArrayList<MapillaryRecordListener> listeners = new ArrayList<>();
+  private final List<MapillaryRecordListener> listeners = new ArrayList<>();
 
   /** The set of commands that have taken place or that have been undone. */
-  public ArrayList<MapillaryCommand> commandList;
+  public List<MapillaryCommand> commandList;
   /** Last written command. */
   public int position;
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 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java	(revision 31974)
@@ -69,16 +69,14 @@
    * Returns the current download mode.
    *
-   * @return 0 - automatic; 1 - semiautomatic; 2 - manual.
+   * @return the currently enabled of the available {@link MODES}
    */
   public static MapillaryDownloader.MODES getMode() {
-    if (Main.pref.get("mapillary.download-mode").equals(MODES.Automatic.toString())
-        && (!MapillaryLayer.hasInstance() || !MapillaryLayer.getInstance().tempSemiautomatic))
-      return MODES.Automatic;
-    else if (Main.pref.get("mapillary.download-mode").equals(MODES.Semiautomatic.toString())
-        || (MapillaryLayer.hasInstance() && MapillaryLayer.getInstance().tempSemiautomatic))
+    String downloadMode = Main.pref.get("mapillary.download-mode", MODES.Automatic.toString());
+    boolean isTempSemiautomatic = MapillaryLayer.hasInstance() && MapillaryLayer.getInstance().tempSemiautomatic;
+    if (MODES.Semiautomatic.toString().equals(downloadMode) || isTempSemiautomatic)
       return MODES.Semiautomatic;
-    else if (Main.pref.get("mapillary.download-mode").equals(MODES.Manual.toString()))
+    else if (MODES.Manual.toString().equals(downloadMode))
       return MODES.Manual;
-    else if ("".equals(Main.pref.get("mapillary.download-mode")))
+    else if (MODES.Automatic.toString().equals(downloadMode))
       return MODES.Automatic;
     else
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySquareDownloadManagerThread.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySquareDownloadManagerThread.java	(revision 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySquareDownloadManagerThread.java	(revision 31974)
@@ -95,6 +95,7 @@
     while (!this.completeExecutor.isShutdown()) {
       this.completeExecutor.execute(new MapillaryImageInfoDownloadThread(completeExecutor, bounds, page));
-      while (this.completeExecutor.getQueue().remainingCapacity() == 0)
+      while (this.completeExecutor.getQueue().remainingCapacity() == 0) {
         Thread.sleep(100);
+      }
       page++;
     }
@@ -112,6 +113,7 @@
     while (!this.signsExecutor.isShutdown()) {
       this.signsExecutor.execute(new MapillaryTrafficSignDownloadThread(this.signsExecutor, bounds, page));
-      while (this.signsExecutor.getQueue().remainingCapacity() == 0)
+      while (this.signsExecutor.getQueue().remainingCapacity() == 0) {
         Thread.sleep(100);
+      }
       page++;
     }
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java	(revision 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java	(revision 31974)
@@ -44,14 +44,13 @@
     if (this.data.getHighlightedImage() == null)
       return;
-    if (this.lastClick == null
-        && this.data.getHighlightedImage() instanceof MapillaryImportedImage) {
+    if (this.lastClick == null && this.data.getHighlightedImage() instanceof MapillaryImportedImage) {
       this.lastClick = (MapillaryImportedImage) this.data.getHighlightedImage();
     } else if (this.lastClick != null
         && this.data.getHighlightedImage() instanceof MapillaryImportedImage) {
-      if (((this.data.getHighlightedImage().previous() == null && this.lastClick
-          .next() == null) || (this.data.getHighlightedImage().next() == null && this.lastClick
-          .previous() == null))
-          && (this.data.getHighlightedImage().getSequence() != this.lastClick
-              .getSequence() || this.lastClick.getSequence() == null)) {
+      if (
+        (this.data.getHighlightedImage().previous() == null && this.lastClick.next() == null
+          || this.data.getHighlightedImage().next() == null && this.lastClick.previous() == null)
+        && (this.data.getHighlightedImage().getSequence() != this.lastClick.getSequence() || this.lastClick.getSequence() == null)
+      ) {
 
         MapillaryRecord.getInstance().addCommand(
@@ -59,12 +58,12 @@
                 this.lastClick, this.data.getHighlightedImage() })));
       } else if (this.lastClick.next() == this.data.getHighlightedImage()
-          || this.lastClick.previous() == this.data.getHighlightedImage())
+          || this.lastClick.previous() == this.data.getHighlightedImage()) {
         MapillaryRecord.getInstance().addCommand(
             new CommandUnjoin(Arrays.asList(new MapillaryAbstractImage[] {
                 this.lastClick, this.data.getHighlightedImage() })));
+      }
       this.lastClick = null;
     }
-    if (Main.main != null)
-      MapillaryData.dataUpdated();
+    MapillaryData.dataUpdated();
   }
 
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryLoginListener.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryLoginListener.java	(revision 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryLoginListener.java	(revision 31974)
@@ -13,9 +13,9 @@
    * @param username the username that the user is now logged in with
    */
-  public void onLogin(final String username);
+  void onLogin(final String username);
   /**
    * Should be called whenever the user logs out of a mapillary account.
    * E.g. for updating the GUI to reflect the login status.
    */
-  public void onLogout();
+  void onLogout();
 }
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 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java	(revision 31974)
@@ -9,4 +9,5 @@
 import java.io.OutputStream;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
@@ -56,4 +57,8 @@
 public class UploadUtils {
 
+  private UploadUtils() {
+    // Private constructor to avoid instantiation.
+  }
+
   /**
    * Required keys for POST
@@ -145,7 +150,7 @@
           throws ImageReadException, IOException, ImageWriteException {
     TiffOutputSet outputSet = null;
-    TiffOutputDirectory exifDirectory = null;
-    TiffOutputDirectory gpsDirectory = null;
-    TiffOutputDirectory rootDirectory = null;
+    TiffOutputDirectory exifDirectory;
+    TiffOutputDirectory gpsDirectory;
+    TiffOutputDirectory rootDirectory;
 
     // If the image is imported, loads the rest of the EXIF data.
@@ -216,10 +221,10 @@
             + image.getCa() + "_" + image.getCapturedAt() + ".jpg";
 
-    String policy = null;
-    String signature = null;
+    String policy;
+    String signature;
     policy = MapillaryUser.getSecrets().get("images_policy");
     signature = MapillaryUser.getSecrets().get("images_hash");
 
-    HashMap<String, String> hash = new HashMap<>();
+    Map<String, String> hash = new HashMap<>();
     hash.put("key", key);
     hash.put("AWSAccessKeyId", "AKIAI2X3BJAT2W75HILA");
@@ -241,6 +246,5 @@
    * @throws IllegalArgumentException if the hash doesn't contain all the needed keys.
    */
-  public static void uploadFile(File file, HashMap<String, String> hash)
-          throws IOException {
+  public static void uploadFile(File file, Map<String, String> hash) throws IOException {
     HttpClientBuilder builder = HttpClientBuilder.create();
     HttpClient httpClient = builder.build();
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java	(revision 31973)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java	(revision 31974)
@@ -363,9 +363,7 @@
         zoomBounds = new Bounds(new LatLon(0, 0));
       } else {
+        zoomBounds = new Bounds(images.iterator().next().getLatLon());
         for (MapillaryAbstractImage img : images) {
-          if (zoomBounds == null) {
-            zoomBounds = new Bounds(img.getLatLon());
-          } else
-            zoomBounds.extend(img.getLatLon());
+          zoomBounds.extend(img.getLatLon());
         }
       }
