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 32199)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 32329)
@@ -111,6 +111,6 @@
       MapView.addEditLayerChangeListener(this, false);
       MapView.addLayerChangeListener(this);
-      if (Main.map.mapView.getEditLayer() != null)
-        Main.map.mapView.getEditLayer().data.addDataSetListener(this);
+      if (Main.getLayerManager().getEditLayer() != null)
+        Main.getLayerManager().getEditLayer().data.addDataSetListener(this);
       if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Automatic)
         MapillaryDownloader.automaticDownload();
@@ -223,6 +223,6 @@
     Main.map.mapView.removeMouseMotionListener(this.mode);
     MapView.removeEditLayerChangeListener(this);
-    if (Main.map.mapView.getEditLayer() != null)
-      Main.map.mapView.getEditLayer().data.removeDataSetListener(this);
+    if (Main.getLayerManager().getEditLayer() != null)
+      Main.getLayerManager().getEditLayer().data.removeDataSetListener(this);
     clearInstance();
     super.destroy();
@@ -286,5 +286,5 @@
   public synchronized void paint(final Graphics2D g, final MapView mv, final Bounds box) {
     g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-    if (Main.map.mapView.getActiveLayer() == this) {
+    if (Main.getLayerManager().getActiveLayer() == this) {
       // paint remainder
       g.setPaint(this.hatched);
@@ -323,5 +323,5 @@
       selectedImageKey = selectedImage.getSequence().getKey();
     }
-    g.setStroke(new BasicStroke(this == Main.map.mapView.getActiveLayer() ? 3 : 2));
+    g.setStroke(new BasicStroke(this == Main.getLayerManager().getActiveLayer() ? 3 : 2));
     for (MapillarySequence seq : getData().getSequences()) {
       if (selectedImageKey != null && selectedImageKey.equals(seq.getKey())) {
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 32199)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java	(revision 32329)
@@ -48,7 +48,7 @@
     }
     // Successive calls to this action toggle the active layer between the OSM data layer and the mapillary layer
-    Main.map.mapView.setActiveLayer(
-        Main.map.mapView.getActiveLayer() == MapillaryLayer.getInstance()
-          ? Main.map.mapView.getEditLayer()
+    Main.getLayerManager().setActiveLayer(
+        Main.getLayerManager().getActiveLayer() == MapillaryLayer.getInstance()
+          ? Main.getLayerManager().getEditLayer()
           : MapillaryLayer.getInstance()
     );
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 32199)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java	(revision 32329)
@@ -152,5 +152,5 @@
   public static void automaticDownload() {
     MapillaryLayer layer = MapillaryLayer.getInstance();
-    if (Main.map.mapView.getEditLayer() == null)
+    if (Main.getLayerManager().getEditLayer() == null)
       return;
     if (isAreaTooBig()) {
@@ -160,5 +160,5 @@
     if (getMode() != MODES.Automatic)
       throw new IllegalStateException("Must be in automatic mode.");
-    for (Bounds bounds : Main.map.mapView.getEditLayer().data
+    for (Bounds bounds : Main.getLayerManager().getEditLayer().data
         .getDataSourceBounds()) {
       if (!layer.getData().getBounds().contains(bounds)) {
@@ -177,5 +177,5 @@
   private static boolean isAreaTooBig() {
     double area = 0;
-    for (Bounds bounds : Main.map.mapView.getEditLayer().data.getDataSourceBounds()) {
+    for (Bounds bounds : Main.getLayerManager().getEditLayer().data.getDataSourceBounds()) {
       area += bounds.getArea();
     }
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 32199)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java	(revision 32329)
@@ -71,5 +71,5 @@
   public void mouseMoved(MouseEvent e) {
     this.lastPos = e;
-    if (!(Main.map.mapView.getActiveLayer() instanceof MapillaryLayer))
+    if (!(Main.getLayerManager().getActiveLayer() instanceof MapillaryLayer))
       return;
     MapillaryAbstractImage closestTemp = getClosest(e.getPoint());
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 32199)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java	(revision 32329)
@@ -52,10 +52,10 @@
       return;
     MapillaryAbstractImage closest = getClosest(e.getPoint());
-    if (!(Main.map.mapView.getActiveLayer() instanceof MapillaryLayer)
+    if (!(Main.getLayerManager().getActiveLayer() instanceof MapillaryLayer)
             && closest != null && Main.map.mapMode == Main.map.mapModeSelect) {
       this.lastClicked = this.closest;
       this.data.setSelectedImage(closest);
       return;
-    } else if (Main.map.mapView.getActiveLayer() != MapillaryLayer
+    } else if (Main.getLayerManager().getActiveLayer() != MapillaryLayer
             .getInstance())
       return;
@@ -98,5 +98,5 @@
   @Override
   public void mouseDragged(MouseEvent e) {
-    if (Main.map.mapView.getActiveLayer() != MapillaryLayer.getInstance()) {
+    if (Main.getLayerManager().getActiveLayer() != MapillaryLayer.getInstance()) {
       return;
     }
@@ -156,5 +156,5 @@
   @Override
   public void mouseMoved(MouseEvent e) {
-    if (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer
+    if (Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer
             && Main.map.mapMode != Main.map.mapModeSelect) {
       return;
@@ -167,5 +167,5 @@
 
     if (closestTemp != null
-            && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer
+            && Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer
             && !this.imageHighlighted) {
       Main.map.mapMode.putValue("active", Boolean.FALSE);
@@ -173,5 +173,5 @@
 
     } else if (closestTemp == null
-            && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer
+            && Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer
             && this.imageHighlighted && this.nothingHighlighted) {
       this.nothingHighlighted = false;
@@ -179,8 +179,8 @@
 
     } else if (this.imageHighlighted && !this.nothingHighlighted
-            && Main.map.mapView.getEditLayer().data != null
-            && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
-
-      for (OsmPrimitive primivitive : Main.map.mapView.getEditLayer().data
+            && Main.getLayerManager().getEditLayer().data != null
+            && Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer) {
+
+      for (OsmPrimitive primivitive : Main.getLayerManager().getEditLayer().data
               .allPrimitives()) {
         primivitive.setHighlighted(false);
