Index: applications/editors/josm/plugins/NanoLog/src/nanolog/Correlator.java
===================================================================
--- applications/editors/josm/plugins/NanoLog/src/nanolog/Correlator.java	(revision 32638)
+++ applications/editors/josm/plugins/NanoLog/src/nanolog/Correlator.java	(revision 33788)
@@ -16,4 +16,5 @@
 import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
 import org.openstreetmap.josm.data.gpx.WayPoint;
+import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.UncheckedParseException;
 import org.openstreetmap.josm.tools.date.DateUtils;
@@ -52,5 +53,5 @@
                         break outer;
                     } catch (Exception e) {
-                        Main.warn(e);
+                        Logging.warn(e);
                     }
                 }
@@ -99,6 +100,6 @@
 
                         } catch (UncheckedParseException e) {
-                            Main.error("Error while parsing date \"" + curWpTimeStr + '"');
-                            Main.error(e);
+                            Logging.error("Error while parsing date \"" + curWpTimeStr + '"');
+                            Logging.error(e);
                             prevWp = null;
                             prevWpTime = 0;
@@ -247,6 +248,6 @@
                             prevWpTime = curWpTime;
                         } catch (UncheckedParseException e) {
-                            Main.error("Error while parsing date \"" + curWpTimeStr + '"');
-                            Main.error(e);
+                            Logging.error("Error while parsing date \"" + curWpTimeStr + '"');
+                            Logging.error(e);
                             prevWp = null;
                             prevWpTime = 0;
Index: applications/editors/josm/plugins/NanoLog/src/nanolog/GPXChooser.java
===================================================================
--- applications/editors/josm/plugins/NanoLog/src/nanolog/GPXChooser.java	(revision 32638)
+++ applications/editors/josm/plugins/NanoLog/src/nanolog/GPXChooser.java	(revision 33788)
@@ -3,5 +3,5 @@
 import javax.swing.JDialog;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.GpxLayer;
 import org.openstreetmap.josm.gui.layer.Layer;
@@ -20,5 +20,5 @@
     public static GpxLayer topLayer() {
         // return first found local layer
-        for (Layer layer : Main.getLayerManager().getLayers()) {
+        for (Layer layer : MainApplication.getLayerManager().getLayers()) {
             if (layer instanceof GpxLayer && ((GpxLayer) layer).isLocalFile())
                 return (GpxLayer) layer;
Index: applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java
===================================================================
--- applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java	(revision 32638)
+++ applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java	(revision 33788)
@@ -37,4 +37,5 @@
 import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
@@ -44,4 +45,5 @@
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.Logging;
 
 /**
@@ -65,12 +67,12 @@
 
     public void setupListeners() {
-        Main.map.mapView.addMouseListener(mouseListener);
-        Main.map.mapView.addMouseMotionListener(mouseListener);
-    }
-
-    @Override
-    public void destroy() {
-        Main.map.mapView.removeMouseListener(mouseListener);
-        Main.map.mapView.removeMouseMotionListener(mouseListener);
+        MainApplication.getMap().mapView.addMouseListener(mouseListener);
+        MainApplication.getMap().mapView.addMouseMotionListener(mouseListener);
+    }
+
+    @Override
+    public synchronized void destroy() {
+        MainApplication.getMap().mapView.removeMouseListener(mouseListener);
+        MainApplication.getMap().mapView.removeMouseMotionListener(mouseListener);
         super.destroy();
     }
@@ -123,5 +125,5 @@
                             timeDate = fmt.parse(time);
                         } catch (ParseException e) {
-                            Main.warn(e);
+                            Logging.warn(e);
                         }
                         if (message == null || message.length() == 0 || timeDate == null)
@@ -132,11 +134,10 @@
                             try {
                                 pos = new LatLon(Double.parseDouble(lat), Double.parseDouble(lon));
-                                direction = new Integer(dir);
+                                direction = Integer.valueOf(dir);
                             } catch (NumberFormatException e) {
-                                Main.trace(e);
+                                Logging.trace(e);
                             }
                         }
-                        NanoLogEntry entry = new NanoLogEntry(timeDate, message, pos, direction);
-                        result.add(entry);
+                        result.add(new NanoLogEntry(timeDate, message, pos, direction));
                     }
                 }
@@ -221,5 +222,5 @@
         else if (selectedEntry >= log.size())
             selectedEntry = log.size() - 1;
-        Main.map.repaint();
+        invalidate();
     }
 
@@ -231,5 +232,5 @@
         else if (selectedEntry >= log.size())
             selectedEntry = log.size() - 1;
-        Main.map.repaint();
+        invalidate();
     }
 
@@ -237,8 +238,7 @@
         int newSelected = i >= 0 && i < log.size() ? i : -1;
         if (newSelected != selectedEntry) {
-//            System.out.println("selected: " + log.get(newSelected).getMessage());
             selectedEntry = newSelected;
             fireMarkerSelected();
-            Main.map.mapView.repaint();
+            invalidate();
         }
     }
@@ -261,8 +261,8 @@
 
         public int nearestEntry(MouseEvent e) {
-            LatLon ll = Main.map.mapView.getLatLon(e.getX(), e.getY());
+            LatLon ll = MainApplication.getMap().mapView.getLatLon(e.getX(), e.getY());
             int radius = 8;
             if (ll != null) {
-                LatLon lld = Main.map.mapView.getLatLon(e.getX() + radius, e.getY() + radius);
+                LatLon lld = MainApplication.getMap().mapView.getLatLon(e.getX() + radius, e.getY() + radius);
                 double distance = Math.max(lld.lat() - ll.lat(), lld.lon() - ll.lon());
                 boolean selectedIsSelected = false;
@@ -303,5 +303,5 @@
         public void mousePressed(MouseEvent e) {
             int nearest = nearestEntry(e);
-            if (nearest > 0 && Main.getLayerManager().getActiveLayer() == NanoLogLayer.this) {
+            if (nearest > 0 && MainApplication.getLayerManager().getActiveLayer() == NanoLogLayer.this) {
                 dragging = nearest;
                 doDrag(e);
@@ -319,6 +319,6 @@
         if (gpx == null)
             return;
-        EastNorth eastNorth = Main.map.mapView.getEastNorth(x, y);
-        double tolerance = eastNorth.distance(Main.map.mapView.getEastNorth(x + 300, y));
+        EastNorth eastNorth = MainApplication.getMap().mapView.getEastNorth(x, y);
+        double tolerance = eastNorth.distance(MainApplication.getMap().mapView.getEastNorth(x + 300, y));
         WayPoint wp = gpx.data.nearestPointOnTrack(eastNorth, tolerance);
         if (wp == null)
@@ -329,5 +329,5 @@
         Correlator.revertPos(log);
         Correlator.correlate(log, gpx.data, log.get(entry).getTime().getTime() - newTime);
-        Main.map.mapView.repaint();
+        MainApplication.getMap().mapView.repaint();
     }
 
@@ -353,5 +353,5 @@
                 Correlator.correlate(log, layer.data, offset);
                 fireMarkersChanged();
-                Main.map.mapView.repaint();
+                MainApplication.getMap().mapView.repaint();
             }
             // 3. Show non-modal (?) window with a slider and a text input
@@ -360,5 +360,5 @@
     }
 
-    private class SaveLayer extends JosmAction {
+    private static class SaveLayer extends JosmAction {
 
         SaveLayer() {
Index: applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPanel.java
===================================================================
--- applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPanel.java	(revision 32638)
+++ applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPanel.java	(revision 33788)
@@ -11,5 +11,5 @@
 import javax.swing.JList;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
 import org.openstreetmap.josm.gui.layer.Layer;
@@ -40,5 +40,5 @@
     public void updateMarkers() {
         List<NanoLogEntry> entries = new ArrayList<>();
-        for (NanoLogLayer l : Main.getLayerManager().getLayersOfType(NanoLogLayer.class)) {
+        for (NanoLogLayer l : MainApplication.getLayerManager().getLayersOfType(NanoLogLayer.class)) {
             entries.addAll(l.getEntries());
         }
@@ -78,5 +78,5 @@
     }
 
-    private class LogListModel extends AbstractListModel<String> {
+    private static class LogListModel extends AbstractListModel<String> {
         private List<NanoLogEntry> entries;
         private final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss");
Index: applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java
===================================================================
--- applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java	(revision 32638)
+++ applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java	(revision 33788)
@@ -12,4 +12,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.plugins.Plugin;
@@ -24,5 +25,5 @@
     public NanoLogPlugin(PluginInformation info) {
         super(info);
-        Main.main.menu.fileMenu.insert(new OpenNanoLogLayerAction(), 4);
+        MainApplication.getMenu().fileMenu.insert(new OpenNanoLogLayerAction(), 4);
     }
 
@@ -32,9 +33,9 @@
             NanoLogPanel panel = new NanoLogPanel();
             newFrame.addToggleDialog(panel);
-            Main.getLayerManager().addLayerChangeListener(panel);
+            MainApplication.getLayerManager().addLayerChangeListener(panel);
         }
     }
 
-    private class OpenNanoLogLayerAction extends JosmAction {
+    private static class OpenNanoLogLayerAction extends JosmAction {
 
         OpenNanoLogLayerAction() {
@@ -50,5 +51,5 @@
                     if (!entries.isEmpty()) {
                         NanoLogLayer layer = new NanoLogLayer(entries);
-                        Main.getLayerManager().addLayer(layer);
+                        MainApplication.getLayerManager().addLayer(layer);
                         layer.setupListeners();
                     }
