Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java	(revision 34454)
@@ -48,4 +48,7 @@
 import org.openstreetmap.josm.plugins.utilsplugin2.selection.UnselectNodesAction;
 
+/**
+ * Collection of utilities
+ */
 public class UtilsPlugin2 extends Plugin {
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AddIntersectionsAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AddIntersectionsAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AddIntersectionsAction.java	(revision 34454)
@@ -19,12 +19,15 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.Notification;
 import org.openstreetmap.josm.tools.Geometry;
 import org.openstreetmap.josm.tools.Shortcut;
 
+/**
+ * Add missing nodes at intersections of selected ways.
+ */
 public class AddIntersectionsAction extends JosmAction {
 
@@ -56,5 +59,5 @@
         Geometry.addIntersections(ways, false, cmds);
         if (!cmds.isEmpty()) {
-            MainApplication.undoRedo.add(new SequenceCommand(tr("Add nodes at intersections"), cmds));
+            UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Add nodes at intersections"), cmds));
             Set<Node> nodes = new HashSet<>(10);
             // find and select newly added nodes
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AlignWayNodesAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AlignWayNodesAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AlignWayNodesAction.java	(revision 34454)
@@ -19,8 +19,8 @@
 import org.openstreetmap.josm.command.MoveCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.Notification;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -128,5 +128,5 @@
 
         if (!commands.isEmpty())
-            MainApplication.undoRedo.add(new SequenceCommand(TITLE, commands));
+            UndoRedoHandler.getInstance().add(new SequenceCommand(TITLE, commands));
     }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java	(revision 34454)
@@ -14,8 +14,8 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Tag;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
@@ -81,5 +81,5 @@
         if (sel.isEmpty()) {
             JOptionPane.showMessageDialog(
-                    Main.parent,
+                    MainApplication.getMainFrame(),
                     tr("Please select something to copy."),
                     tr("Information"),
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java	(revision 34454)
@@ -20,4 +20,5 @@
 import org.openstreetmap.josm.command.MoveCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -73,5 +74,5 @@
             }
         }
-        if (cmds.size() > 1) MainApplication.undoRedo.add(new SequenceCommand(tr("Extract node from line"), cmds));
+        if (cmds.size() > 1) UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Extract node from line"), cmds));
     }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java	(revision 34454)
@@ -15,14 +15,13 @@
 import java.util.Map;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.command.ChangeCommand;
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.PrimitiveData;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.RelationMember;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
@@ -101,5 +100,5 @@
 
         if (!commands.isEmpty())
-            MainApplication.undoRedo.add(new SequenceCommand(TITLE, commands));
+            UndoRedoHandler.getInstance().add(new SequenceCommand(TITLE, commands));
     }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java	(revision 34454)
@@ -21,8 +21,8 @@
 import org.openstreetmap.josm.command.DeleteCommand;
 import org.openstreetmap.josm.command.SplitWayCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.Notification;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -210,7 +210,7 @@
             SplitWayCommand result = SplitWayCommand.splitWay(
                     selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList());
-            MainApplication.undoRedo.add(result);
+            UndoRedoHandler.getInstance().add(result);
             if (splitWay != null)
-                MainApplication.undoRedo.add(new DeleteCommand(splitWay));
+                UndoRedoHandler.getInstance().add(new DeleteCommand(splitWay));
             getLayerManager().getEditDataSet().setSelected(result.getNewSelection());
         }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java	(revision 34454)
@@ -19,8 +19,8 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.command.SplitWayCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.Notification;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -92,5 +92,5 @@
 
         if (!list.isEmpty()) {
-            MainApplication.undoRedo.add(list.size() == 1 ? list.get(0) : new SequenceCommand(TITLE, list));
+            UndoRedoHandler.getInstance().add(list.size() == 1 ? list.get(0) : new SequenceCommand(TITLE, list));
             getLayerManager().getEditDataSet().clearSelection();
         }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SymmetryAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SymmetryAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SymmetryAction.java	(revision 34454)
@@ -13,9 +13,9 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.MoveCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.osm.Node;
@@ -88,5 +88,5 @@
         }
 
-        MainApplication.undoRedo.add(new SequenceCommand(tr("Symmetry"), cmds));
+        UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Symmetry"), cmds));
         MainApplication.getMap().repaint();
     }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java	(revision 34454)
@@ -19,6 +19,6 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.tools.Shortcut;
 import org.openstreetmap.josm.tools.SubclassFilteredCollection;
@@ -69,5 +69,5 @@
 
         if (!commands.isEmpty())
-            MainApplication.undoRedo.add(new SequenceCommand(TITLE, commands));
+            UndoRedoHandler.getInstance().add(new SequenceCommand(TITLE, commands));
     }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagSourceAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagSourceAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagSourceAction.java	(revision 34454)
@@ -10,9 +10,9 @@
 import java.util.Set;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.command.ChangePropertyCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Shortcut;
 
@@ -32,5 +32,5 @@
                 Shortcut.registerShortcut("tools:sourcetag", tr("Tool: {0}", tr("Add Source Tag")), KeyEvent.VK_S, Shortcut.ALT_CTRL),
                 true, false);
-        source = Main.pref.get("sourcetag.value");
+        source = Config.getPref().get("sourcetag.value");
         // The fields are not initialized while the super constructor is running, so we have to call this afterwards:
         installAdapters();
@@ -43,5 +43,5 @@
             return;
 
-        MainApplication.undoRedo.add(new ChangePropertyCommand(selection, "source", source));
+        UndoRedoHandler.getInstance().add(new ChangePropertyCommand(selection, "source", source));
     }
 
@@ -82,5 +82,5 @@
                 if (newSource != null && newSource.length() > 0 && !newSource.equals(source)) {
                     source = newSource;
-                    Main.pref.put("sourcetag.value", source);
+                    Config.getPref().put("sourcetag.value", source);
                 }
             }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java	(revision 34454)
@@ -15,4 +15,5 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -81,5 +82,5 @@
             // error message nothing to do
         } else {
-            MainApplication.undoRedo.add(new SequenceCommand(tr("Unglued Relations"), cmds));
+            UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Unglued Relations"), cmds));
             //Set selection all primiteves (new and old)
             newPrimitives.addAll(selection);
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java	(revision 34454)
@@ -24,4 +24,7 @@
 import org.openstreetmap.josm.gui.MainApplication;
 
+/**
+ * Create a circle arc
+ */
 public final class CircleArcMaker {
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CurveAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CurveAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CurveAction.java	(revision 34454)
@@ -11,16 +11,19 @@
 import java.util.List;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Shortcut;
 
 // TODO: investigate splines
 
+/**
+ * Create a circle arc
+ */
 public class CurveAction extends JosmAction {
 
@@ -39,5 +42,5 @@
     private void updatePreferences() {
         // @formatter:off
-        angleSeparation = Main.pref.getInt(prefKey("circlearc.angle-separation"), 20);
+        angleSeparation = Config.getPref().getInt(prefKey("circlearc.angle-separation"), 20);
         // @formatter:on
     }
@@ -59,5 +62,5 @@
         Collection<Command> cmds = CircleArcMaker.doCircleArc(selectedNodes, selectedWays, angleSeparation);
         if (cmds != null)
-            MainApplication.undoRedo.add(new SequenceCommand("Create a curve", cmds));
+            UndoRedoHandler.getInstance().add(new SequenceCommand("Create a curve", cmds));
     }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java	(revision 34454)
@@ -17,9 +17,13 @@
 import javax.swing.event.ListSelectionListener;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.gui.ExtendedDialog;
+import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.GBC;
 
+/**
+ * Select custom URL
+ */
 public class ChooseURLAction extends JosmAction {
 
@@ -56,5 +60,5 @@
         final JCheckBox check1 = new JCheckBox(tr("Ask every time"));
 
-        final ExtendedDialog dialog = new ExtendedDialog(Main.parent,
+        final ExtendedDialog dialog = new ExtendedDialog(MainApplication.getMainFrame(),
                 tr("Configure custom URL"),
                 new String[] {tr("OK"), tr("Cancel")}
@@ -69,5 +73,5 @@
         });
         list1.setSelectedIndex(idxToSelect);
-        check1.setSelected(Main.pref.getBoolean("utilsplugin2.askurl", false));
+        check1.setSelected(Config.getPref().getBoolean("utilsplugin2.askurl", false));
 
         editField.setEditable(false);
@@ -87,5 +91,5 @@
         if (ret == 1 && idx >= 0) {
             URLList.select(vals[idx]);
-            Main.pref.putBoolean("utilsplugin2.askurl", check1.isSelected());
+            Config.getPref().putBoolean("utilsplugin2.askurl", check1.isSelected());
         }
         return ret;
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java	(revision 34454)
@@ -13,5 +13,4 @@
 import java.util.regex.Pattern;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -20,4 +19,5 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.OpenBrowser;
@@ -50,5 +50,5 @@
         }
 
-        if (Main.pref.getBoolean("utilsplugin2.askurl", false) && 1 != ChooseURLAction.showConfigDialog(true)) {
+        if (Config.getPref().getBoolean("utilsplugin2.askurl", false) && 1 != ChooseURLAction.showConfigDialog(true)) {
             return;
         }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java	(revision 34454)
@@ -13,8 +13,12 @@
 import java.util.logging.Logger;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Logging;
 
+/**
+ * List of custom URLs
+ */
 public final class URLList {
     public static final String defaultURL = "http://osm.mapki.com/history/{#type}.php?id={#id}";
@@ -26,9 +30,9 @@
     public static String getSelectedURL() {
         getURLList();
-        return Main.pref.get("utilsplugin2.customurl", defaultURL);
+        return Config.getPref().get("utilsplugin2.customurl", defaultURL);
     }
 
     public static void select(String url) {
-        Main.pref.put("utilsplugin2.customurl", url);
+        Config.getPref().put("utilsplugin2.customurl", url);
     }
 
@@ -47,14 +51,14 @@
         items.add("Browse element [demo, =Ctrl-Shift-I]");
         items.add("https://www.openstreetmap.org/{#type}/{#id}");
-        Main.pref.putList("utilsplugin2.urlHistory", items);
-        Main.pref.put("utilsplugin2.customurl", items.get(9));
+        Config.getPref().putList("utilsplugin2.urlHistory", items);
+        Config.getPref().put("utilsplugin2.customurl", items.get(9));
         return items;
     }
 
     public static List<String> getURLList() {
-        List<String> items = Main.pref.getList("utilsplugin2.urlHistory");
+        List<String> items = Config.getPref().getList("utilsplugin2.urlHistory");
         if (items == null || items.isEmpty()) {
             resetURLList();
-            items = Main.pref.getList("utilsplugin2.urlHistory");
+            items = Config.getPref().getList("utilsplugin2.urlHistory");
         }
         return items;
@@ -62,7 +66,7 @@
 
     public static void updateURLList(List<String> lst) {
-        Main.pref.putList("utilsplugin2.urlHistory", lst);
+        Config.getPref().putList("utilsplugin2.urlHistory", lst);
         try {
-            Main.pref.save();
+            Preferences.main().save();
         } catch (IOException ex) {
             Logger.getLogger(UtilsPluginPreferences.class.getName()).log(Level.SEVERE, null, ex);
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/UtilsPluginPreferences.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/UtilsPluginPreferences.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/UtilsPluginPreferences.java	(revision 34454)
@@ -26,4 +26,7 @@
 import org.openstreetmap.josm.tools.GBC;
 
+/**
+ * Preferences of Utilsplugin2 functions
+ */
 public class UtilsPluginPreferences extends DefaultTabPreferenceSetting {
     HistoryComboBox combo1 = new HistoryComboBox();
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java	(revision 34454)
@@ -10,9 +10,9 @@
 import java.util.LinkedList;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.command.AddCommand;
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -41,5 +41,5 @@
             return;
 
-        LatLonDialog dialog = new LatLonDialog(Main.parent, tr("Add Node..."), ht("/Action/AddNode"));
+        LatLonDialog dialog = new LatLonDialog(MainApplication.getMainFrame(), tr("Add Node..."), ht("/Action/AddNode"));
 
         if (textLatLon != null) {
@@ -83,5 +83,5 @@
             cmds.add(new AddCommand(ds, wnew));
         }
-        MainApplication.undoRedo.add(new SequenceCommand(tr("Lat Lon tool"), cmds));
+        UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Lat Lon tool"), cmds));
         MainApplication.getMap().mapView.repaint();
     }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java	(revision 34454)
@@ -32,5 +32,4 @@
 import javax.swing.event.DocumentListener;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager;
@@ -38,8 +37,12 @@
 import org.openstreetmap.josm.data.coor.conversion.LatLonParser;
 import org.openstreetmap.josm.gui.ExtendedDialog;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.util.WindowGeometry;
 import org.openstreetmap.josm.gui.widgets.HtmlPanel;
 import org.openstreetmap.josm.tools.GBC;
 
+/**
+ * Dialog for entering lat/lon coordinates.
+ */
 public class LatLonDialog extends ExtendedDialog {
     private static final Color BG_COLOR_ERROR = new Color(255, 224, 224);
@@ -167,5 +170,5 @@
 
     public LatLonDialog(Component parent, String title, String help) {
-        super(Main.parent, tr("Add Node..."), new String[] {tr("Ok"), tr("Cancel")});
+        super(MainApplication.getMainFrame(), tr("Add Node..."), new String[] {tr("Ok"), tr("Cancel")});
         setButtonIcons(new String[] {"ok", "cancel"});
         configureContextsensitiveHelp("/Action/AddNode", true);
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagAction.java	(revision 34454)
@@ -13,4 +13,7 @@
 import org.openstreetmap.josm.tools.Shortcut;
 
+/**
+ * Edit tags of object list in table
+ */
 public final class MultiTagAction extends JosmAction {
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java	(revision 34454)
@@ -40,5 +40,4 @@
 import javax.swing.table.DefaultTableCellRenderer;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.AutoScaleAction;
 import org.openstreetmap.josm.actions.search.SearchAction;
@@ -59,4 +58,5 @@
 import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -81,5 +81,5 @@
 
     public MultiTagDialog() {
-        super(Main.parent, tr("Edit tags"), new String[]{tr("Ok"), tr("Cancel")}, false);
+        super(MainApplication.getMainFrame(), tr("Edit tags"), new String[]{tr("Ok"), tr("Cancel")}, false);
         JPanel pnl = new JPanel(new GridBagLayout());
         tbl = createTable();
@@ -112,5 +112,5 @@
         loadHistory();
 
-        WindowGeometry defaultGeometry = WindowGeometry.centerInWindow(Main.parent, new Dimension(500, 500));
+        WindowGeometry defaultGeometry = WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(500, 500));
         setRememberWindowGeometry(getClass().getName() + ".geometry", defaultGeometry);
     }
@@ -151,5 +151,5 @@
     private void loadHistory() {
         List<String> cmtHistory = new LinkedList<>(
-                Main.pref.getList(HISTORY_KEY, Arrays.asList(defaultHistory)));
+                Config.getPref().getList(HISTORY_KEY, Arrays.asList(defaultHistory)));
         Collections.reverse(cmtHistory);
         cbTagSet.setPossibleItems(cmtHistory);
@@ -303,5 +303,5 @@
                 history = Arrays.asList(defaultHistory);
             }
-            Main.pref.putList(HISTORY_KEY, history);
+            Config.getPref().putList(HISTORY_KEY, history);
             loadHistory();
         }
@@ -336,5 +336,5 @@
             oldTags = s;
             cbTagSet.addCurrentItemToHistory();
-            Main.pref.putList(HISTORY_KEY, cbTagSet.getHistory());
+            Config.getPref().putList(HISTORY_KEY, cbTagSet.getHistory());
             specifyTagSet(s);
         }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java	(revision 34454)
@@ -16,4 +16,5 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.SelectionChangedListener;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
@@ -22,4 +23,7 @@
 import org.openstreetmap.josm.tools.Geometry;
 
+/**
+ * Model of the multi tag table.
+ */
 public class MultiTaggerTableModel extends AbstractTableModel implements SelectionChangedListener {
 
@@ -115,5 +119,5 @@
             Command cmd = new ChangePropertyCommand(sel, key, (String) value);
             if (autoCommit) {
-                MainApplication.undoRedo.add(cmd);
+                UndoRedoHandler.getInstance().add(cmd);
             } else {
                 cmds.add(cmd);
@@ -185,5 +189,5 @@
 
     void commit(String commandTitle) {
-        MainApplication.undoRedo.add(new SequenceCommand(commandTitle, cmds));
+        UndoRedoHandler.getInstance().add(new SequenceCommand(commandTitle, cmds));
         cmds.clear();
     }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryAction.java	(revision 34454)
@@ -13,6 +13,6 @@
 
 import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.Notification;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -58,5 +58,5 @@
                 return;
 
-            MainApplication.undoRedo.add(replaceCommand);
+            UndoRedoHandler.getInstance().add(replaceCommand);
         } catch (IllegalArgumentException ex) {
             new Notification(
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryException.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryException.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryException.java	(revision 34454)
@@ -3,5 +3,5 @@
 
 /**
- *
+ * Exception thrown when replace geometry fails.
  * @author joshdoe
  */
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java	(revision 34454)
@@ -18,5 +18,4 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.MergeNodesAction;
 import org.openstreetmap.josm.command.ChangeNodesCommand;
@@ -36,4 +35,5 @@
 import org.openstreetmap.josm.gui.Notification;
 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.UserCancelException;
@@ -42,5 +42,5 @@
 
 /**
- *
+ * Utilities for Replace Geometry
  * @author joshdoe
  */
@@ -276,6 +276,6 @@
         int nLen = nodePool.size();
         int N = Math.max(gLen, nLen);
-        boolean useRobust = Main.pref.getBoolean("utilsplugin2.replace-geometry.robustAssignment", true)
-                && N <= Main.pref.getInt("utilsplugin2.replace-geometry.robustAssignment.max-size", 300);
+        boolean useRobust = Config.getPref().getBoolean("utilsplugin2.replace-geometry.robustAssignment", true)
+                && N <= Config.getPref().getInt("utilsplugin2.replace-geometry.robustAssignment.max-size", 300);
 
         // Find new nodes that are closest to the old ones, remove matching old ones from the pool
@@ -291,5 +291,5 @@
                 }
 
-                double maxDistance = Double.parseDouble(Main.pref.get("utilsplugin2.replace-geometry.max-distance", "1"));
+                double maxDistance = Double.parseDouble(Config.getPref().get("utilsplugin2.replace-geometry.max-distance", "1"));
                 for (int i = 0; i < nLen; i++) {
                     for (int j = 0; j < gLen; j++) {
@@ -468,5 +468,5 @@
         Node nearest = null;
         // TODO: use meters instead of degrees, but do it fast
-        double distance = Double.parseDouble(Main.pref.get("utilsplugin2.replace-geometry.max-distance", "1"));
+        double distance = Double.parseDouble(Config.getPref().get("utilsplugin2.replace-geometry.max-distance", "1"));
         LatLon coor = node.getCoor();
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceMembershipAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceMembershipAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceMembershipAction.java	(revision 34454)
@@ -18,4 +18,5 @@
 import org.openstreetmap.josm.command.ChangeCommand;
 import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -23,8 +24,10 @@
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.data.osm.RelationToChildReference;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.Notification;
 import org.openstreetmap.josm.tools.MultiMap;
 
+/**
+ * In relations where the selected object is member of, replace it with a new one
+ */
 public class ReplaceMembershipAction extends JosmAction {
 
@@ -45,5 +48,5 @@
         final int affectedRelations = command != null ? command.getChildren().size() : 0;
         if (affectedRelations > 0) {
-            MainApplication.undoRedo.add(command);
+            UndoRedoHandler.getInstance().add(command);
             new Notification(trn("Replaced ''{0}'' by ''{1}'' in {2} relation", "Replaced ''{0}'' by ''{1}'' in {2} relations",
                     affectedRelations,
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ChildrenMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ChildrenMatch.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ChildrenMatch.java	(revision 34454)
@@ -7,6 +7,6 @@
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
 import org.openstreetmap.josm.data.osm.search.SearchParseError;
-import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
 
 /**
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ConnectedMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ConnectedMatch.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ConnectedMatch.java	(revision 34454)
@@ -67,3 +67,29 @@
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + (all ? 1231 : 1237);
+        result = prime * result + ((connected == null) ? 0 : connected.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj) || getClass() != obj.getClass())
+            return false;
+        ConnectedMatch other = (ConnectedMatch) obj;
+        if (all != other.all)
+            return false;
+        if (connected == null) {
+            if (other.connected != null)
+                return false;
+        } else if (!connected.equals(other.connected))
+            return false;
+        return true;
+    }
+
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/InsideMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/InsideMatch.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/InsideMatch.java	(revision 34454)
@@ -51,3 +51,23 @@
         return inside.contains(osm);
     }
+
+    @Override
+    public int hashCode() {
+        return 31 * super.hashCode() + ((inside == null) ? 0 : inside.hashCode());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj) || getClass() != obj.getClass())
+            return false;
+        InsideMatch other = (InsideMatch) obj;
+        if (inside == null) {
+            if (other.inside != null)
+                return false;
+        } else if (!inside.equals(other.inside))
+            return false;
+        return true;
+    }
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/IntersectingMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/IntersectingMatch.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/IntersectingMatch.java	(revision 34454)
@@ -57,3 +57,29 @@
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + (all ? 1231 : 1237);
+        result = prime * result + ((intersecting == null) ? 0 : intersecting.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj) || getClass() != obj.getClass())
+            return false;
+        IntersectingMatch other = (IntersectingMatch) obj;
+        if (all != other.all)
+            return false;
+        if (intersecting == null) {
+            if (other.intersecting != null)
+                return false;
+        } else if (!intersecting.equals(other.intersecting))
+            return false;
+        return true;
+    }
+
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java	(revision 34454)
@@ -5,6 +5,6 @@
 
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
 import org.openstreetmap.josm.data.osm.search.SearchParseError;
-import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
 
 /**
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java	(revision 34454)
@@ -40,4 +40,27 @@
         return getString() + "=" + min + "-" + max;
     }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (int) (max ^ (max >>> 32));
+        result = prime * result + (int) (min ^ (min >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+        RangeMatch other = (RangeMatch) obj;
+        if (max != other.max)
+            return false;
+        if (min != other.min)
+            return false;
+        return true;
+    }
 }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java	(revision 34454)
@@ -7,7 +7,11 @@
 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
 import org.openstreetmap.josm.data.osm.search.SearchCompiler;
+import org.openstreetmap.josm.data.osm.search.SearchCompiler.CoreSimpleMatchFactory;
 import org.openstreetmap.josm.data.osm.search.SearchCompiler.SimpleMatchFactory;
 import org.openstreetmap.josm.data.osm.search.SearchParseError;
 
+/**
+ * Extension of the {@link CoreSimpleMatchFactory}
+ */
 public class UtilsSimpleMatchFactory implements SimpleMatchFactory {
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsUnaryMatchFactory.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsUnaryMatchFactory.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsUnaryMatchFactory.java	(revision 34454)
@@ -5,8 +5,12 @@
 import java.util.Collection;
 
-import org.openstreetmap.josm.data.osm.search.SearchParseError;
 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
 import org.openstreetmap.josm.data.osm.search.SearchCompiler;
+import org.openstreetmap.josm.data.osm.search.SearchCompiler.CoreUnaryMatchFactory;
+import org.openstreetmap.josm.data.osm.search.SearchParseError;
 
+/**
+ * Extension of the {@link CoreUnaryMatchFactory}.
+ */
 public class UtilsUnaryMatchFactory implements SearchCompiler.UnaryMatchFactory {
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java	(revision 34454)
@@ -14,5 +14,4 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.osm.BBox;
@@ -23,4 +22,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.Notification;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Geometry;
 import org.openstreetmap.josm.tools.Pair;
@@ -32,7 +32,7 @@
 public final class NodeWayUtils {
 
-    static final int maxLevel = Main.pref.getInt("selection.maxrecursion", 15);
-    static final int maxWays = Main.pref.getInt("selection.maxfoundways", 2000);
-    static final int maxWays1 = Main.pref.getInt("selection.maxfoundways.intersection", 500);
+    static final int maxLevel = Config.getPref().getInt("selection.maxrecursion", 15);
+    static final int maxWays = Config.getPref().getInt("selection.maxfoundways", 2000);
+    static final int maxWays1 = Config.getPref().getInt("selection.maxfoundways.intersection", 500);
 
     private NodeWayUtils() {
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java	(revision 34454)
@@ -13,8 +13,8 @@
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.tools.Shortcut;
 
@@ -42,11 +42,11 @@
             Command cmd = null;
 
-            if (MainApplication.undoRedo.commands == null) return;
-            int num = MainApplication.undoRedo.commands.size();
+            if (UndoRedoHandler.getInstance().commands == null) return;
+            int num = UndoRedoHandler.getInstance().commands.size();
             if (num == 0) return;
             int k = 0, idx;
             if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) {
                 // we are selecting next command in history if nothing is selected
-                idx = MainApplication.undoRedo.commands.indexOf(lastCmd);
+                idx = UndoRedoHandler.getInstance().commands.indexOf(lastCmd);
             } else {
                 idx = num;
@@ -56,5 +56,5 @@
             do {  //  select next history element
                 if (idx > 0) idx--; else idx = num-1;
-                cmd = MainApplication.undoRedo.commands.get(idx);
+                cmd = UndoRedoHandler.getInstance().commands.get(idx);
                 Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
                 nodes.clear();
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java	(revision 34263)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java	(revision 34454)
@@ -13,9 +13,9 @@
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.tools.Shortcut;
 
@@ -43,11 +43,11 @@
             Command cmd;
 
-            if (MainApplication.undoRedo.commands == null) return;
-            int num = MainApplication.undoRedo.commands.size();
+            if (UndoRedoHandler.getInstance().commands == null) return;
+            int num = UndoRedoHandler.getInstance().commands.size();
             if (num == 0) return;
             int k = 0, idx;
             if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) {
                 // we are selecting next command in history if nothing is selected
-                idx = MainApplication.undoRedo.commands.indexOf(lastCmd);
+                idx = UndoRedoHandler.getInstance().commands.indexOf(lastCmd);
             } else {
                 idx = num;
@@ -57,5 +57,5 @@
             do {  //  select next history element
                 if (idx > 0) idx--; else idx = num-1;
-                cmd = MainApplication.undoRedo.commands.get(idx);
+                cmd = UndoRedoHandler.getInstance().commands.get(idx);
                 Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
                 ways.clear();
