Index: /applications/editors/josm/plugins/routes/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- /applications/editors/josm/plugins/routes/.settings/org.eclipse.jdt.ui.prefs	(revision 32455)
+++ /applications/editors/josm/plugins/routes/.settings/org.eclipse.jdt.ui.prefs	(revision 32456)
@@ -7,6 +7,6 @@
 sp_cleanup.add_missing_methods=false
 sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=false
-sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
 sp_cleanup.add_serial_version_id=false
 sp_cleanup.always_use_blocks=true
@@ -16,5 +16,5 @@
 sp_cleanup.convert_functional_interfaces=false
 sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
+sp_cleanup.correct_indentation=true
 sp_cleanup.format_source_code=false
 sp_cleanup.format_source_code_changes_only=false
Index: /applications/editors/josm/plugins/routes/build.xml
===================================================================
--- /applications/editors/josm/plugins/routes/build.xml	(revision 32455)
+++ /applications/editors/josm/plugins/routes/build.xml	(revision 32456)
@@ -2,5 +2,5 @@
 <project name="routes" default="dist" basedir=".">
     <property name="commit.message" value="Changed the constructor signature of the plugin main class"/>
-    <property name="plugin.main.version" value="10279"/>
+    <property name="plugin.main.version" value="10353"/>
     <property name="josm" location="../../core/dist/josm-custom.jar"/>
     <property name="plugin.dist.dir" value="../../dist"/>
Index: /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RelationEditMode.java
===================================================================
--- /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RelationEditMode.java	(revision 32455)
+++ /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RelationEditMode.java	(revision 32456)
@@ -62,9 +62,9 @@
     @Override
     public void mouseClicked(MouseEvent e) {
-        if (Main.main.getCurrentDataSet() == null)
+        if (getLayerManager().getEditDataSet() == null)
             return;
 
         Way way = Main.map.mapView.getNearestWay(e.getPoint(), OsmPrimitive.isUsablePredicate);
-        Collection<Relation> selectedRelations = Main.main.getCurrentDataSet().getSelectedRelations();
+        Collection<Relation> selectedRelations = getLayerManager().getEditDataSet().getSelectedRelations();
 
         if (way != null) {
Index: /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java
===================================================================
--- /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java	(revision 32455)
+++ /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java	(revision 32456)
@@ -104,5 +104,5 @@
     public void paint(Graphics2D g, MapView mv, Bounds bounds) {
 
-        DataSet dataset = Main.main.getCurrentDataSet();
+        DataSet dataset = Main.getLayerManager().getEditDataSet();
 
         if (dataset == null) {
Index: /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RoutesPlugin.java
===================================================================
--- /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RoutesPlugin.java	(revision 32455)
+++ /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RoutesPlugin.java	(revision 32456)
@@ -15,7 +15,9 @@
 
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.gui.MapView;
-import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
 import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.plugins.Plugin;
@@ -31,5 +33,5 @@
     public RoutesPlugin(PluginInformation info) {
         super(info);
-        MapView.addLayerChangeListener(this);
+        Main.getLayerManager().addLayerChangeListener(this);
 
         File routesFile = new File(getPluginDir() + File.separator + "routes.xml");
@@ -40,7 +42,7 @@
                 routesFile.getParentFile().mkdir();
                 try (
-                    OutputStream outputStream = new FileOutputStream(routesFile);
-                    InputStream inputStream = Routes.class.getResourceAsStream("routes.xml");
-                ) {
+                        OutputStream outputStream = new FileOutputStream(routesFile);
+                        InputStream inputStream = Routes.class.getResourceAsStream("routes.xml");
+                        ) {
                     byte[] b = new byte[512];
                     int read;
@@ -84,7 +86,8 @@
                         isShown = true;
                         SwingUtilities.invokeLater(new Runnable() {
+                            @Override
                             public void run() {
                                 for (RouteLayer routeLayer:routeLayers) {
-                                    Main.main.addLayer(routeLayer);
+                                    Main.getLayerManager().addLayer(routeLayer);
                                 }
                             }
@@ -97,7 +100,8 @@
                 isShown = false;
                 SwingUtilities.invokeLater(new Runnable() {
+                    @Override
                     public void run() {
                         for (RouteLayer routeLayer:routeLayers) {
-                            Main.main.removeLayer(routeLayer);
+                            Main.getLayerManager().removeLayer(routeLayer);
                         }
                     }
@@ -107,10 +111,17 @@
     }
 
-    public void layerAdded(Layer newLayer) {
+    @Override
+    public void layerAdded(LayerAddEvent e) {
         checkLayers();
     }
 
-    public void layerRemoved(Layer oldLayer) {
+    @Override
+    public void layerRemoving(LayerRemoveEvent e) {
         checkLayers();
     }
+
+    @Override
+    public void layerOrderChanged(LayerOrderChangeEvent e) {
+        // Do nothing
+    }
 }
