Index: applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantPaintVisitor.java
===================================================================
--- applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantPaintVisitor.java	(revision 32554)
+++ applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantPaintVisitor.java	(revision 32557)
@@ -291,5 +291,6 @@
 			if (parent.getType().equals(OsmPrimitiveType.RELATION)) {
 				Relation relation = (Relation) parent;
-				if (RouteUtils.isTwoDirectionRoute(relation) && relation.get("ref") != null && !relation.get("ref").equals("")) {
+				if (RouteUtils.isTwoDirectionRoute(relation) && relation.get("ref") != null
+						&& !relation.get("ref").equals("")) {
 
 					boolean stringFound = false;
@@ -331,15 +332,33 @@
 		public int compare(String s1, String s2) {
 
-			if (s1 == null || s1.equals("")) {
-				if (s2 == null || s2.equals("")) {
-					return 0;
-				} else {
-					return 1;
-				}
-			}
-
-			String firstNumberString1 = s1.split("\\D+")[0];
-			String firstNumberString2 = s2.split("\\D+")[0];
-			
+			if (s1 == null || s1.equals("") || s2 == null || s2.equals("")) {
+				// if at least one of the strings is null or empty, there is no
+				// point in comparing:
+				return 0;
+			}
+
+			String[] splitString1 = s1.split("\\D");
+			String[] splitString2 = s2.split("\\D");
+
+			if (splitString1.length == 0 && splitString2.length != 0) {
+				// if the first ref does not start a digit and the second ref
+				// starts with a digit:
+				return 1;
+			}
+
+			if (splitString1.length != 0 && splitString2.length == 0) {
+				// if the first ref starts a digit and the second ref does not
+				// start with a digit:
+				return -1;
+			}
+
+			if (splitString1.length == 0 && splitString2.length == 0) {
+				// if both ref values do not start with a digit:
+				return s1.compareTo(s2);
+			}
+
+			String firstNumberString1 = splitString1[0];
+			String firstNumberString2 = splitString2[0];
+
 			try {
 				int firstNumber1 = Integer.valueOf(firstNumberString1);
Index: applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PTAssitantValidatorTest.java
===================================================================
--- applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PTAssitantValidatorTest.java	(revision 32554)
+++ applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PTAssitantValidatorTest.java	(revision 32557)
@@ -98,5 +98,5 @@
 			if (SwingUtilities.isEventDispatchThread()) {
 
-				userSelection[0] = realDownloadIncompleteMembers();
+				userSelection[0] = showIncompleteMembersDownloadDialog();
 
 			} else {
@@ -106,5 +106,5 @@
 					public void run() {
 						try {
-							userSelection[0] = realDownloadIncompleteMembers();
+							userSelection[0] = showIncompleteMembersDownloadDialog();
 						} catch (InterruptedException e) {
 							e.printStackTrace();
@@ -144,5 +144,5 @@
 	 * @throws InterruptedException
 	 */
-	private int realDownloadIncompleteMembers() throws InterruptedException {
+	private int showIncompleteMembersDownloadDialog() throws InterruptedException {
 
 		IncompleteMembersDownloadDialog incompleteMembersDownloadDialog = new IncompleteMembersDownloadDialog();
@@ -169,8 +169,31 @@
 		}
 
-		ProceedDialog proceedDialog = new ProceedDialog(r.getId(), numberOfDirectionErrors, numberOfRoadTypeErrors);
-		int userInput = proceedDialog.getUserSelection();
-
-		if (userInput == 0) {
+		final int[] userInput = { 0 };
+		final long idParameter = r.getId();
+		final int directionErrorParameter = numberOfDirectionErrors;
+		final int roadTypeErrorParameter = numberOfRoadTypeErrors;
+
+		if (SwingUtilities.isEventDispatchThread()) {
+
+			userInput[0] = showProceedDialog(idParameter, directionErrorParameter, roadTypeErrorParameter);
+
+		} else {
+
+			try {
+				SwingUtilities.invokeAndWait(new Runnable() {
+					@Override
+					public void run() {
+						userInput[0] = showProceedDialog(idParameter, roadTypeErrorParameter, roadTypeErrorParameter);
+
+					}
+				});
+			} catch (InvocationTargetException | InterruptedException e1) {
+				// TODO Auto-generated catch block
+				e1.printStackTrace();
+			}
+
+		}
+
+		if (userInput[0] == 0) {
 			this.fixErrorFromPlugin(this.errors);
 			proceedWithSorting(r);
@@ -178,5 +201,5 @@
 		}
 
-		if (userInput == 1) {
+		if (userInput[0] == 1) {
 			// TODO
 			JOptionPane.showMessageDialog(null, "This is not implemented yet!");
@@ -184,5 +207,5 @@
 		}
 
-		if (userInput == 2) {
+		if (userInput[0] == 2) {
 			// TODO: should the errors be removed from the error list?
 			proceedWithSorting(r);
@@ -191,4 +214,11 @@
 		// if userInput==-1 (i.e. no input), do nothing and stop testing of the
 		// route.
+
+	}
+
+	private int showProceedDialog(long id, int numberOfDirectionErrors, int numberOfRoadTypeErrors) {
+
+		ProceedDialog proceedDialog = new ProceedDialog(id, numberOfDirectionErrors, numberOfRoadTypeErrors);
+		return proceedDialog.getUserSelection();
 
 	}
Index: applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/WayChecker.java
===================================================================
--- applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/WayChecker.java	(revision 32554)
+++ applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/WayChecker.java	(revision 32557)
@@ -6,4 +6,6 @@
 import java.util.Collection;
 import java.util.List;
+
+import javax.swing.SwingUtilities;
 
 import org.openstreetmap.josm.Main;
@@ -12,4 +14,5 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.SelectCommand;
+import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
@@ -29,5 +32,6 @@
 
 /**
- * Performs tests of a route at the level of single ways: DirectionTest and RoadTypeTest
+ * Performs tests of a route at the level of single ways: DirectionTest and
+ * RoadTypeTest
  * 
  * @author darya
@@ -35,5 +39,5 @@
  */
 public class WayChecker extends Checker {
-
+	
 	public WayChecker(Relation relation, Test test) {
 
@@ -43,5 +47,5 @@
 
 	protected void performRoadTypeTest() {
-		
+
 		if (!relation.hasTag("route", "bus") && !relation.hasTag("route", "trolleybus")
 				&& !relation.hasTag("route", "share_taxi")) {
@@ -121,5 +125,5 @@
 
 				}
-				
+
 				if (isUnderConstruction) {
 					List<Relation> primitives = new ArrayList<>(1);
@@ -127,6 +131,5 @@
 					List<Way> highlighted = new ArrayList<>(1);
 					highlighted.add(way);
-					TestError e = new TestError(this.test, Severity.WARNING,
-							tr("PT: Road is under construction"),
+					TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Road is under construction"),
 							PTAssitantValidatorTest.ERROR_CODE_CONSTRUCTION, primitives, highlighted);
 					errors.add(e);
@@ -215,8 +218,9 @@
 		return false;
 	}
-	
+
 	protected static Command fixErrorByRemovingWay(TestError testError) {
 
-		if (testError.getCode() != PTAssitantValidatorTest.ERROR_CODE_ROAD_TYPE && testError.getCode() != PTAssitantValidatorTest.ERROR_CODE_DIRECTION) {
+		if (testError.getCode() != PTAssitantValidatorTest.ERROR_CODE_ROAD_TYPE
+				&& testError.getCode() != PTAssitantValidatorTest.ERROR_CODE_DIRECTION) {
 			return null;
 		}
@@ -272,72 +276,75 @@
 		return changeCommand;
 	}
-	
 
 	protected static Command fixErrorByZooming(TestError testError) {
-		
+
 		if (testError.getCode() != PTAssitantValidatorTest.ERROR_CODE_DIRECTION) {
 			return null;
 		}
 		
-		 long startTime = System.currentTimeMillis();
-		
+		ArrayList<Command> commands = new ArrayList<>();
+
 		Collection<? extends OsmPrimitive> primitives = testError.getPrimitives();
 		Relation originalRelation = (Relation) primitives.iterator().next();
+		ArrayList<OsmPrimitive> primitivesToSelect = new ArrayList<>(1);
+		primitivesToSelect.add(originalRelation);
 		Collection<?> highlighted = testError.getHighlighted();
 		Way wayToHighlight = (Way) highlighted.iterator().next();
-		ArrayList<OsmPrimitive> primitivesToHighlight = new ArrayList<>(1);
-		primitivesToHighlight.add(wayToHighlight);
+		ArrayList<OsmPrimitive> primitivesToZoom = new ArrayList<>(1);
+		primitivesToZoom.add(wayToHighlight);
+
+		SelectCommand command1 = new SelectCommand(primitivesToSelect);
+		commands.add(command1);
+		SelectCommand command2 = new SelectCommand(primitivesToZoom);
+		commands.add(command2);
+
+		List<OsmDataLayer> listOfLayers = Main.getLayerManager().getLayersOfType(OsmDataLayer.class);
+		for (OsmDataLayer osmDataLayer : listOfLayers) {
+			if (osmDataLayer.data == originalRelation.getDataSet()) {
+
+				final OsmDataLayer layerParameter = osmDataLayer;
+				final Relation relationParameter = originalRelation;
+				final Collection<OsmPrimitive> zoomParameter = primitivesToZoom;
+
+				if (SwingUtilities.isEventDispatchThread()) {
+
+					showRelationEditorAndZoom(layerParameter, relationParameter, zoomParameter);
+
+				} else {
+
+					SwingUtilities.invokeLater(new Runnable() {
+						@Override
+						public void run() {
+
+							showRelationEditorAndZoom(layerParameter, relationParameter, zoomParameter);
+
+						}
+					});
+
+				}
+
+				return new SequenceCommand(null, commands);
+			}
+		}
+
+		return null;
+
+	}
+
+	private static void showRelationEditorAndZoom(OsmDataLayer layer, Relation r, Collection<OsmPrimitive> primitives) {
+
+		AutoScaleAction.zoomTo(primitives);
+		GenericRelationEditor editor = new GenericRelationEditor(layer, r, r.getMembersFor(primitives));
+		RelationDialogManager.getRelationDialogManager().register(layer, r, editor);
 		
-		long endTime = System.currentTimeMillis();
-		System.out.println("obtaining primitives: " + (endTime - startTime));
-		startTime = endTime;
 		
-		SelectCommand command = new SelectCommand(primitivesToHighlight);
+		editor.setVisible(true);
+//		editor.requestFocus();
+//		editor.requestFocusInWindow();
 		
-		endTime = System.currentTimeMillis();
-		System.out.println("constructing command: " + (endTime - startTime));
-		startTime = endTime;
-		
-		AutoScaleAction.zoomTo(primitivesToHighlight);
-		
-		endTime = System.currentTimeMillis();
-		System.out.println("AutoScaleAction done: " + (endTime - startTime));
-		startTime = endTime;
-		
-		List<OsmDataLayer> listOfLayers = Main.getLayerManager().getLayersOfType(OsmDataLayer.class);
-		for (OsmDataLayer osmDataLayer: listOfLayers) {
-			if (osmDataLayer.data == originalRelation.getDataSet()) {
-				endTime = System.currentTimeMillis();
-				System.out.println("getting to the necessary layer: " + (endTime - startTime));
-				startTime = endTime;
-				
-				GenericRelationEditor editor = new GenericRelationEditor(osmDataLayer, originalRelation, originalRelation.getMembersFor(primitivesToHighlight));
-				endTime = System.currentTimeMillis();
-				System.out.println("creating relation editor: " + (endTime - startTime));
-				startTime = endTime;
-				
-				RelationDialogManager.getRelationDialogManager().register(osmDataLayer, originalRelation, editor);
-				
-				endTime = System.currentTimeMillis();
-				System.out.println("registering relation editor: " + (endTime - startTime));
-				startTime = endTime;
-				
-				editor.setVisible(true);
-				
-				endTime = System.currentTimeMillis();
-				System.out.println("setting editor visible: " + (endTime - startTime));
-				startTime = endTime;
-				
-				break;
-			}
-		}
-		
-		endTime = System.currentTimeMillis();
-		System.out.println("whatever else: " + (endTime - startTime));
-		startTime = endTime;
-						
-		return command;
-		
-	}
-	
+//		editor.firePropertyChange("focusedWindow", editor, editor);
+//		editor.setRelation(r);
+
+	}
+
 }
