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 31421)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31422)
@@ -107,4 +107,6 @@
    */
   private void init() {
+    if (INSTANCE == null)
+      INSTANCE = this;
     if (Main.map != null && Main.map.mapView != null) {
       setMode(new SelectMode());
@@ -114,4 +116,8 @@
       if (Main.map.mapView.getEditLayer() != null)
         Main.map.mapView.getEditLayer().data.addDataSetListener(this);
+      if (MapillaryDownloader.getMode() == MapillaryDownloader.AUTOMATIC)
+        MapillaryDownloader.automaticDownload();
+      if (MapillaryDownloader.getMode() == MapillaryDownloader.SEMIAUTOMATIC)
+        mode.zoomChanged();
     }
     if (MapillaryPlugin.EXPORT_MENU != null) { // Does not execute when in
@@ -154,5 +160,5 @@
   public synchronized static MapillaryLayer getInstance() {
     if (INSTANCE == null)
-      INSTANCE = new MapillaryLayer();
+      return new MapillaryLayer();
     return MapillaryLayer.INSTANCE;
   }
@@ -445,6 +451,6 @@
    * Returns the 2 closest images belonging to a different sequence.
    *
-   * @return An array of length 2 containing the two closest images belonging
-   *         to different sequences.
+   * @return An array of length 2 containing the two closest images belonging to
+   *         different sequences.
    */
   private MapillaryImage[] getClosestImagesFromDifferentSequences() {
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31421)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31422)
@@ -148,6 +148,5 @@
       Main.map.addToggleDialog(MapillaryFilterDialog.getInstance(), false);
       setMenuEnabled(DOWNLOAD_MENU, true);
-      if (Main.pref.get("mapillary.download-mode").equals(
-          MapillaryDownloader.MODES[2]))
+      if (MapillaryDownloader.getMode() == MapillaryDownloader.MANUAL)
         setMenuEnabled(DOWNLOAD_VIEW_MENU, true);
       setMenuEnabled(IMPORT_MENU, true);
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java	(revision 31421)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java	(revision 31422)
@@ -6,9 +6,5 @@
 import java.awt.event.KeyEvent;
 
-import javax.swing.JOptionPane;
-
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
-import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader;
@@ -26,8 +22,4 @@
   private static final long serialVersionUID = -6837073336175123503L;
 
-  /** Max area to be downloaded */
-  public static final double MAX_AREA = Main.pref.getDouble(
-      "mapillary.max-download-area", 0.015);
-
   /**
    * Main constructor.
@@ -44,11 +36,5 @@
   @Override
   public void actionPerformed(ActionEvent arg0) {
-    MapillaryLayer.getInstance().bounds.add(Main.map.mapView.getRealBounds());
-    if (Main.map.mapView.getRealBounds().getArea() <= MAX_AREA) {
-      MapillaryDownloader.getImages(Main.map.mapView.getRealBounds());
-    } else {
-      JOptionPane.showMessageDialog(Main.parent,
-          tr("This area is too big to be downloaded"));
-    }
+    MapillaryDownloader.completeView();
   }
 }
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 31421)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java	(revision 31422)
@@ -9,4 +9,5 @@
 
 import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
 
 import org.openstreetmap.josm.Main;
@@ -15,5 +16,4 @@
 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
-import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryDownloadViewAction;
 
 /**
@@ -29,4 +29,14 @@
   public static final String[] MODES = new String[] { "Automatic",
       "Semiautomatic", "Manual" };
+  /** Automatic mode. */
+  public static final int AUTOMATIC = 0;
+  /** Semiautomatic mode. */
+  public static final int SEMIAUTOMATIC = 1;
+  /** Manual mode. */
+  public static final int MANUAL = 2;
+
+  /** Max area to be downloaded */
+  public static final double MAX_AREA = Main.pref.getDouble(
+      "mapillary.max-download-area", 0.015);
 
   /** Base URL of the Mapillary API. */
@@ -66,6 +76,8 @@
    */
   public static void completeView() {
+    if (getMode() != SEMIAUTOMATIC && getMode() != MANUAL)
+      throw new IllegalStateException("Must be in semiautomatic or manual mode");
     Bounds view = Main.map.mapView.getRealBounds();
-    if (view.getArea() > MapillaryDownloadViewAction.MAX_AREA)
+    if (view.getArea() > MAX_AREA)
       return;
     if (isViewDownloaded(view))
@@ -81,6 +93,6 @@
       for (int j = 0; j < n; j++) {
         if (isInBounds(new LatLon(view.getMinLat()
-            + (view.getMaxLat() - view.getMinLat()) * ((double) i / n), view.getMinLon()
- + (view.getMaxLon() - view.getMinLon())
+            + (view.getMaxLat() - view.getMinLat()) * ((double) i / n),
+            view.getMinLon() + (view.getMaxLon() - view.getMinLon())
                 * ((double) j / n)))) {
           inside[i][j] = true;
@@ -120,9 +132,11 @@
   public static void automaticDownload() {
     MapillaryLayer layer = MapillaryLayer.getInstance();
-    checkAreaTooBig();
-    if (!Main.pref.get("mapillary.download-mode").equals(
-        MapillaryDownloader.MODES[0])
-        || layer.TEMP_SEMIAUTOMATIC)
+    if (isAreaTooBig()) {
+      tooBigErrorDialog();
       return;
+    }
+
+    if (getMode() != AUTOMATIC)
+      throw new IllegalStateException("Must be in automatic mode.");
     for (Bounds bounds : Main.map.mapView.getEditLayer().data
         .getDataSourceBounds()) {
@@ -140,5 +154,5 @@
    * and you will have to download areas manually.
    */
-  private static void checkAreaTooBig() {
+  private static boolean isAreaTooBig() {
     double area = 0;
     for (Bounds bounds : Main.map.mapView.getEditLayer().data
@@ -146,5 +160,36 @@
       area += bounds.getArea();
     }
-    if (area > MapillaryDownloadViewAction.MAX_AREA) {
+    if (area > MAX_AREA)
+      return true;
+    return false;
+  }
+
+  /**
+   * Returns the current download mode.
+   *
+   * @return 0 - automatic; 1 - semiautomatic; 2 - manual.
+   */
+  public static int getMode() {
+    if (Main.pref.get("mapillary.download-mode").equals(MODES[0])
+        && !MapillaryLayer.getInstance().TEMP_SEMIAUTOMATIC)
+      return 0;
+    else if (Main.pref.get("mapillary.download-mode").equals(MODES[1])
+        || MapillaryLayer.getInstance().TEMP_SEMIAUTOMATIC)
+      return 1;
+    else if (Main.pref.get("mapillary.download-mode").equals(MODES[2]))
+      return 2;
+    else
+      throw new IllegalStateException();
+  }
+
+  private static void tooBigErrorDialog() {
+    if (!SwingUtilities.isEventDispatchThread()) {
+      SwingUtilities.invokeLater(new Runnable() {
+        @Override
+        public void run() {
+          tooBigErrorDialog();
+        }
+      });
+    } else {
       MapillaryLayer.getInstance().TEMP_SEMIAUTOMATIC = true;
       MapillaryPlugin.setMenuEnabled(MapillaryPlugin.DOWNLOAD_VIEW_MENU, true);
@@ -152,5 +197,5 @@
           .showMessageDialog(
               Main.parent,
-              tr("The downloaded OSM area is too big. Download mode has been changed to manual until the layer is restarted."));
+              tr("The downloaded OSM area is too big. Download mode has been changed to semiautomatic until the layer is restarted."));
     }
   }
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java	(revision 31421)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java	(revision 31422)
@@ -64,7 +64,5 @@
   @Override
   public void zoomChanged() {
-    if (Main.pref.get("mapillary.download-mode").equals(
-        MapillaryDownloader.MODES[1])
-        || MapillaryLayer.getInstance().TEMP_SEMIAUTOMATIC) {
+    if (MapillaryDownloader.getMode() == MapillaryDownloader.SEMIAUTOMATIC) {
       if (!semiautomaticThread.isAlive())
         semiautomaticThread.start();
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 31421)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java	(revision 31422)
@@ -18,5 +18,4 @@
 import org.openstreetmap.josm.plugins.mapillary.commands.CommandTurnImage;
 import org.openstreetmap.josm.plugins.mapillary.commands.MapillaryRecord;
-import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader;
 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryMainDialog;
 
@@ -42,7 +41,4 @@
   public SelectMode() {
     record = MapillaryRecord.getInstance();
-    if (Main.pref.get("mapillary.download-mode").equals(
-        MapillaryDownloader.MODES[1]))
-      zoomChanged();
   }
 
