Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java	(revision 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java	(revision 31460)
@@ -21,6 +21,7 @@
 
   /**
-   * Lock that locks next() and previous() methods. Used when downloading images
-   * to prevent concurrency problems.
+   * Lock that locks {@link MapillaryAbstractImage#next()} and
+   * {@link MapillaryAbstractImage#previous()} methods. Used when downloading
+   * images to prevent concurrency problems.
    */
   public static Lock LOCK = new ReentrantLock();
@@ -213,5 +214,6 @@
    * Returns the date the picture was taken in the given format.
    *
-   * @param format Format of the date. See {@link SimpleDateFormat}.
+   * @param format
+   *          Format of the date. See {@link SimpleDateFormat}.
    * @return A String containing the date the picture was taken using the given
    *         format.
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 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31460)
@@ -117,5 +117,5 @@
    * @return The image under the mouse cursor.
    */
-  public MapillaryAbstractImage getHighlighted() {
+  public MapillaryAbstractImage getHighlightedImage() {
     return this.highlightedImage;
   }
@@ -239,5 +239,5 @@
   public void selectPrevious(boolean moveToPicture) {
     if (getSelectedImage() == null)
-      return;
+      throw new IllegalStateException();
     if (getSelectedImage().getSequence() == null)
       throw new IllegalStateException();
@@ -277,5 +277,5 @@
     this.multiSelectedImages.clear();
     this.multiSelectedImages.add(image);
-    if (image != null) {
+    if (image != null && Main.main != null) {
       if (image instanceof MapillaryImage) {
         MapillaryImage mapillaryImage = (MapillaryImage) image;
@@ -284,16 +284,17 @@
           CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next());
           if (mapillaryImage.next().next() != null)
-            CacheUtils
-                .downloadPicture((MapillaryImage) mapillaryImage.next().next());
+            CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next()
+                .next());
         }
         if (mapillaryImage.previous() != null) {
-          CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.previous());
+          CacheUtils
+              .downloadPicture((MapillaryImage) mapillaryImage.previous());
           if (mapillaryImage.previous().previous() != null)
-            CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.previous()
-                .previous());
+            CacheUtils.downloadPicture((MapillaryImage) mapillaryImage
+                .previous().previous());
         }
       }
     }
-    if (zoom)
+    if (zoom && Main.main != null)
       Main.map.mapView.zoomTo(getSelectedImage().getLatLon());
     if (Main.main != null)
@@ -325,5 +326,6 @@
         this.setSelectedImage(image);
     }
-    Main.map.mapView.repaint();
+    if (Main.main != null)
+      Main.map.mapView.repaint();
   }
 
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 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31460)
@@ -415,5 +415,5 @@
     g.drawImage(op.filter(bi, null), p.x - (width / 2), p.y - (height / 2),
         Main.map.mapView);
-    if (this.data.getHighlighted() == image) {
+    if (this.data.getHighlightedImage() == image) {
       drawPointHighlight(g, p, 16);
     }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java	(revision 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java	(revision 31460)
@@ -139,21 +139,3 @@
     return this.images.get(i - 1);
   }
-
-  /**
-   * Returns the difference of index between two {@link MapillaryAbstractImage}
-   * objects belonging to the same {@link MapillarySequence}.
-   *
-   * @param image1
-   *          The first image.
-   * @param image2
-   *          The second image.
-   * @return The distance between two {@link MapillaryAbstractImage} objects
-   *         belonging to the same {@link MapillarySequence}.
-   */
-  public int getDistance(MapillaryAbstractImage image1,
-      MapillaryAbstractImage image2) {
-    if (!this.images.contains(image1) || !this.images.contains(image2))
-      throw new IllegalArgumentException();
-    return Math.abs(this.images.indexOf(image1) - this.images.indexOf(image2));
-  }
 }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/WalkThread.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/WalkThread.java	(revision 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/WalkThread.java	(revision 31460)
@@ -22,7 +22,7 @@
  */
 public class WalkThread extends Thread implements MapillaryDataListener {
-  private int interval;
-  private MapillaryData data;
-  private Lock lock = new ReentrantLock();
+  private final int interval;
+  private final MapillaryData data;
+  private final Lock lock;
   private boolean end = false;
   private final boolean waitForFullQuality;
@@ -53,4 +53,5 @@
     this.data = MapillaryLayer.getInstance().getData();
     this.data.addListener(this);
+    this.lock = new ReentrantLock();
   }
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java	(revision 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java	(revision 31460)
@@ -45,6 +45,5 @@
   public final static String CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz";
   /** Executor that will run the petitions. */
-  private static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(3, 5,
-      100, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(50));
+  private static ThreadPoolExecutor EXECUTOR;
 
   /**
@@ -63,4 +62,6 @@
     queryStringParts.put("max_lat", maxLatLon.lat());
     queryStringParts.put("max_lon", maxLatLon.lon());
+    EXECUTOR = new ThreadPoolExecutor(3, 5, 100, TimeUnit.SECONDS,
+        new ArrayBlockingQueue<Runnable>(50));
     run(new MapillarySquareDownloadManagerThread(queryStringParts));
   }
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 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java	(revision 31460)
@@ -33,24 +33,24 @@
   protected JOptionPane optionPane;
   /** Button to export all downloaded images. */
-  public JRadioButton all;
+  public final JRadioButton all;
   /**
    * Button to export all images in the sequence of the selected MapillaryImage.
    */
-  public JRadioButton sequence;
+  public final JRadioButton sequence;
   /**
    * Button to export all images belonging to the selected
    * {@link MapillaryImage} objects.
    */
-  public JRadioButton selected;
+  public final JRadioButton selected;
   /** Button to rewrite all imported images. */
-  public JRadioButton rewrite;
+  public final JRadioButton rewrite;
   /** Group of button containing all the options. */
-  public ButtonGroup group;
-  private JButton choose;
-  private JLabel path;
+  public final ButtonGroup group;
+  private final JButton choose;
+  private final JLabel path;
   /** File chooser. */
   public JFileChooser chooser;
   protected String exportDirectory;
-  private JButton ok;
+  private final JButton ok;
 
   /**
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 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java	(revision 31460)
@@ -57,4 +57,5 @@
   private Rectangle selectedRect = null;
 
+  /** HyperlinkLabel shown in the bottom right corner. */
   protected HyperlinkLabel hyperlink;
 
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 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java	(revision 31460)
@@ -37,19 +37,19 @@
   @Override
   public void mousePressed(MouseEvent e) {
-    if (this.data.getHighlighted() == null)
+    if (this.data.getHighlightedImage() == null)
       return;
     if (this.lastClick == null
-        && this.data.getHighlighted() instanceof MapillaryImportedImage) {
-      this.lastClick = (MapillaryImportedImage) this.data.getHighlighted();
+        && this.data.getHighlightedImage() instanceof MapillaryImportedImage) {
+      this.lastClick = (MapillaryImportedImage) this.data.getHighlightedImage();
     } else if (this.lastClick != null
-        && this.data.getHighlighted() instanceof MapillaryImportedImage) {
-      if (((this.data.getHighlighted().previous() == null && this.lastClick.next() == null) || (this.data
-          .getHighlighted().next() == null && this.lastClick.previous() == null))
-          && (this.data.getHighlighted().getSequence() != this.lastClick.getSequence() || this.lastClick
+        && 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)) {
-        join(this.lastClick, (MapillaryImportedImage) this.data.getHighlighted());
-      } else if (this.lastClick.next() == this.data.getHighlighted()
-          || this.lastClick.previous() == this.data.getHighlighted())
-        unjoin(this.lastClick, (MapillaryImportedImage) this.data.getHighlighted());
+        join(this.lastClick, (MapillaryImportedImage) this.data.getHighlightedImage());
+      } else if (this.lastClick.next() == this.data.getHighlightedImage()
+          || this.lastClick.previous() == this.data.getHighlightedImage())
+        unjoin(this.lastClick, (MapillaryImportedImage) this.data.getHighlightedImage());
       this.lastClick = null;
     }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java	(revision 31459)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java	(revision 31460)
@@ -182,9 +182,9 @@
     }
 
-    if (this.data.getHighlighted() != closestTemp && closestTemp != null) {
+    if (this.data.getHighlightedImage() != closestTemp && closestTemp != null) {
       this.data.setHighlightedImage(closestTemp);
       MapillaryMainDialog.getInstance().setImage(closestTemp);
       MapillaryMainDialog.getInstance().updateImage(false);
-    } else if (this.data.getHighlighted() != closestTemp && closestTemp == null) {
+    } else if (this.data.getHighlightedImage() != closestTemp && closestTemp == null) {
       this.data.setHighlightedImage(null);
       MapillaryMainDialog.getInstance().setImage(this.data.getSelectedImage());
