Index: /applications/editors/josm/plugins/mapillary/.classpath
===================================================================
--- /applications/editors/josm/plugins/mapillary/.classpath	(revision 31213)
+++ /applications/editors/josm/plugins/mapillary/.classpath	(revision 31214)
@@ -5,4 +5,5 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM-commons-imaging"/>
+	<classpathentry kind="lib" path="/home/nokutu/josm/dist/commons-imaging.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
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 31213)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31214)
@@ -4,4 +4,5 @@
 
 import org.apache.commons.jcs.access.CacheAccess;
+import org.openstreetmap.josm.plugins.mapillary.cache.MapillaryCache;
 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader;
 import org.openstreetmap.josm.Main;
@@ -50,5 +51,5 @@
 
 	public final static int SEQUENCE_MAX_JUMP_DISTANCE = 100;
-	
+
 	public static Boolean INSTANCED = false;
 	public static MapillaryLayer INSTANCE;
@@ -252,5 +253,6 @@
 	private MapillaryImage[] getClosestImagesFromDifferentSequences() {
 		MapillaryImage[] ret = new MapillaryImage[2];
-		double[] distances = { SEQUENCE_MAX_JUMP_DISTANCE, SEQUENCE_MAX_JUMP_DISTANCE };
+		double[] distances = { SEQUENCE_MAX_JUMP_DISTANCE,
+				SEQUENCE_MAX_JUMP_DISTANCE };
 		LatLon selectedCoords = mapillaryData.getSelectedImage().getLatLon();
 		for (MapillaryImage image : mapillaryData.getImages()) {
@@ -274,4 +276,11 @@
 			}
 		}
+		// Predownloads the thumbnails
+		if (ret[0] != null)
+			new MapillaryCache(ret[0].getKey(), MapillaryCache.Type.THUMBNAIL)
+					.submit(MapillaryData.getInstance(), false);
+		if (ret[1] != null)
+			new MapillaryCache(ret[1].getKey(), MapillaryCache.Type.THUMBNAIL)
+					.submit(MapillaryData.getInstance(), false);
 		return ret;
 	}
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPreferenceSetting.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPreferenceSetting.java	(revision 31213)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPreferenceSetting.java	(revision 31214)
@@ -6,4 +6,5 @@
 import javax.swing.JPanel;
 
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;
@@ -12,5 +13,5 @@
 public class MapillaryPreferenceSetting implements SubPreferenceSetting {
 
-	private JCheckBox reverseButtons;
+	private JCheckBox reverseButtons = new JCheckBox("Reverse buttons position when displaying images.");;
 	
 	@Override
@@ -23,5 +24,7 @@
 		// TODO Auto-generated method stub
 		JPanel panel = new JPanel();
-		reverseButtons = new JCheckBox("Reverse buttons position when displaying images.");
+		
+		reverseButtons.setSelected(Main.pref.getBoolean("mapillary.reverse-buttons"));
+		
 		panel.add(reverseButtons);
 		panel.setLayout(new FlowLayout(FlowLayout.LEFT));
@@ -31,6 +34,7 @@
 	@Override
 	public boolean ok() {
-		// TODO Auto-generated method stub
-		return false;
+        boolean mod = false;
+        Main.pref.put("mapillary.reverse-buttons", reverseButtons.isSelected());
+        return mod;
 	}
 
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java	(revision 31213)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java	(revision 31214)
@@ -7,8 +7,12 @@
 import java.awt.BorderLayout;
 import java.awt.Color;
+import java.awt.Component;
 import java.awt.FlowLayout;
+import java.awt.GridLayout;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
 
 import org.openstreetmap.josm.Main;
@@ -22,4 +26,7 @@
 
 import javax.imageio.ImageIO;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JScrollPane;
 import javax.swing.SwingUtilities;
 import javax.swing.AbstractAction;
@@ -45,10 +52,11 @@
 	final SideButton blueButton = new SideButton(new blueAction());
 
+	private JPanel buttonsPanel;
+	private JPanel top;
+
 	public MapillaryImageDisplay mapillaryImageDisplay;
 
 	private MapillaryCache imageCache;
 	private MapillaryCache thumbnailCache;
-
-	final JPanel buttons;
 
 	public MapillaryToggleDialog() {
@@ -56,21 +64,19 @@
 				tr("Open Mapillary window"), null, 200);
 		mapillaryImageDisplay = new MapillaryImageDisplay();
-		this.add(mapillaryImageDisplay);
-		buttons = new JPanel();
-		buttons.setLayout(new FlowLayout(FlowLayout.CENTER));
+
+		// this.add(mapillaryImageDisplay);
 		blueButton.setForeground(Color.BLUE);
 		redButton.setForeground(Color.RED);
-		buttons.add(blueButton);
-		buttons.add(previousButton);
-		buttons.add(nextButton);
-		buttons.add(redButton);
-
-		this.add(buttons, BorderLayout.SOUTH);
+
+		this.setLayout(new BorderLayout());
+		top = new JPanel();
+		top.setLayout(new BorderLayout());
+		top.add(titleBar, BorderLayout.NORTH);
 
 		createLayout(
 				mapillaryImageDisplay,
-				true,
 				Arrays.asList(new SideButton[] { blueButton, previousButton,
-						nextButton, redButton }));
+						nextButton, redButton }),
+				Main.pref.getBoolean("mapillary.reverse-buttons"));
 	}
 
@@ -269,3 +275,23 @@
 		}
 	}
+
+	public void createLayout(Component data, List<SideButton> buttons,
+			boolean reverse) {
+		add(data, BorderLayout.CENTER);
+		if (!buttons.isEmpty() && buttons.get(0) != null) {
+			buttonsPanel = new JPanel(new GridLayout(1, 1));
+			final JPanel buttonRowPanel = new JPanel(Main.pref.getBoolean(
+					"dialog.align.left", false) ? new FlowLayout(
+					FlowLayout.LEFT) : new GridLayout(1, buttons.size()));
+			buttonsPanel.add(buttonRowPanel);
+			for (SideButton button : buttons) {
+				buttonRowPanel.add(button);
+			}
+			if (reverse)
+				top.add(buttonsPanel, BorderLayout.SOUTH);
+			else
+				add(buttonsPanel, BorderLayout.SOUTH);
+		}
+		add(top, BorderLayout.NORTH);
+	}
 }
