Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31166)
@@ -20,4 +20,6 @@
  * 
  * @author nokutu
+ * @see MapillaryImage
+ * @see MapillarySequence
  *
  */
@@ -178,12 +180,24 @@
 				e.printStackTrace();
 			}
-			if (image.next() != null)
+			if (image.next() != null) {
 				new MapillaryCache(image.next().getKey(),
-						MapillaryCache.Type.FULL_IMAGE, prev, 200000, 200000,
+						MapillaryCache.Type.THUMBNAIL, prev, 200000, 200000,
 						new HashMap<String, String>()).submit(this, false);
-			if (image.previous() != null)
+				if (image.next().next() != null)
+					new MapillaryCache(image.next().next().getKey(),
+							MapillaryCache.Type.THUMBNAIL, prev, 200000,
+							200000, new HashMap<String, String>()).submit(this,
+							false);
+			}
+			if (image.previous() != null) {
 				new MapillaryCache(image.previous().getKey(),
-						MapillaryCache.Type.FULL_IMAGE, prev, 200000, 200000,
+						MapillaryCache.Type.THUMBNAIL, prev, 200000, 200000,
 						new HashMap<String, String>()).submit(this, false);
+				if (image.previous().previous() != null)
+					new MapillaryCache(image.previous().previous().getKey(),
+							MapillaryCache.Type.THUMBNAIL, prev, 200000,
+							200000, new HashMap<String, String>()).submit(this,
+							false);
+			}
 		}
 		if (Main.map != null) {
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDownloadAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDownloadAction.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDownloadAction.java	(revision 31166)
@@ -27,5 +27,5 @@
 				tr("Create Mapillary layer."), Shortcut.registerShortcut(
 						"menu:Mapillary", tr("Menu: {0}", tr("Mapillary")),
-						KeyEvent.VK_M, Shortcut.ALT_SHIFT), false);
+						KeyEvent.VK_M, Shortcut.ALT_CTRL_SHIFT), false);
 	}
 
@@ -44,5 +44,4 @@
 		for (Layer layer : Main.map.mapView.getAllLayers()) {
 			if (layer instanceof MapillaryLayer) {
-				System.out.println("Tuturu");
 				this.layer = (MapillaryLayer) layer;
 			}
@@ -51,6 +50,11 @@
 		if (this.layer == null)
 			layer = new MapillaryLayer();
-		else
+		else {
 			this.layer.download();
+			if (Main.map.mapView.getActiveLayer() != layer)
+				Main.map.mapView.setActiveLayer(layer);
+			else
+				Main.map.mapView.setActiveLayer(Main.map.mapView.getEditLayer());
+		}
 	}
 
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java	(revision 31166)
@@ -7,5 +7,6 @@
  * 
  * @author nokutu
- *
+ * @see MapillarySequence
+ * @see MapillaryData
  */
 public class MapillaryImage {
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImageDisplay.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImageDisplay.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImageDisplay.java	(revision 31166)
@@ -32,5 +32,5 @@
 
 	/** The image currently displayed */
-	private transient Image image = null;
+	private transient BufferedImage image = null;
 
 	/**
@@ -319,4 +319,8 @@
 		}
 		repaint();
+	}
+	
+	public BufferedImage getImage() {
+		return this.image;
 	}
 
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 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31166)
@@ -43,9 +43,10 @@
 		MouseListener, DataSetListener, EditLayerChangeListener {
 
+	public static Boolean INSTANCED = false;
+	public static CacheAccess<String, BufferedImageCacheEntry> CACHE;
+	
 	private final MapillaryData mapillaryData;
 	private List<Bounds> bounds;
 	private MapillaryToggleDialog tgd;
-	public static Boolean INSTANCED = false;
-	public static CacheAccess<String, BufferedImageCacheEntry> CACHE;
 
 	public MapillaryLayer() {
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31166)
@@ -20,11 +20,13 @@
 
 	public static final ImageIcon ICON = new ImageProvider("icon24.png").get();
-	public static final ImageIcon ICON16 = new ImageProvider("icon16.png").get();
-	public static final ImageIcon ICON16SELECTED = new ImageProvider("icon16selected.png").get();
+	public static final ImageIcon ICON16 = new ImageProvider("icon16.png")
+			.get();
+	public static final ImageIcon ICON16SELECTED = new ImageProvider(
+			"icon16selected.png").get();
 	public static final int ICON_SIZE = 24;
-	
+
 	MapillaryDownloadAction downloadAction;
 	MapillaryExportAction exportAction;
-	
+
 	public static JMenuItem DOWNLOAD_MENU;
 	public static JMenuItem EXPORT_MENU;
@@ -35,6 +37,8 @@
 		exportAction = new MapillaryExportAction();
 
-		DOWNLOAD_MENU = MainMenu.add(Main.main.menu.imageryMenu, downloadAction, false, 0);
-		EXPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, exportAction, false, 14);
+		DOWNLOAD_MENU = MainMenu.add(Main.main.menu.imageryMenu,
+				downloadAction, false, 0);
+		EXPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, exportAction,
+				false, 14);
 		EXPORT_MENU.setEnabled(false);
 
@@ -47,14 +51,12 @@
 	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
 		if (oldFrame == null && newFrame != null) { // map frame added
-			MapillaryToggleDialog.deleteInstance ();
 		}
-		if (oldFrame != null && newFrame == null) { // map frame added
-			System.out.println("Mapframe destroyed");
+		if (oldFrame != null && newFrame == null) { // map frame destroyed
+			MapillaryToggleDialog.deleteInstance();
 		}
 	}
-	
+
 	public static void setMenuEnabled(JMenuItem menu, boolean value) {
 		menu.setEnabled(value);
 	}
 }
-
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java	(revision 31166)
@@ -8,4 +8,5 @@
  * 
  * @author nokutu
+ * @see MapillaryImage
  *
  */
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 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java	(revision 31166)
@@ -46,4 +46,7 @@
 	public MapillaryImageDisplay mapillaryImageDisplay;
 
+	private MapillaryCache imageCache;
+	private MapillaryCache thumbnailCache;
+
 	final JPanel buttons;
 
@@ -90,9 +93,19 @@
 				CacheAccess<String, BufferedImageCacheEntry> prev;
 				try {
+					this.mapillaryImageDisplay.setImage(null);
 					prev = JCSCacheManager.getCache("mapillary");
-					MapillaryCache cache = new MapillaryCache(image.getKey(),
+					if (thumbnailCache != null)
+						thumbnailCache.cancelOutstandingTasks();
+					thumbnailCache = new MapillaryCache(image.getKey(),
+							MapillaryCache.Type.THUMBNAIL, prev, 200000,
+							200000, new HashMap<String, String>());
+					thumbnailCache.submit(this, false);
+					
+					if (imageCache != null)
+						imageCache.cancelOutstandingTasks();
+					imageCache = new MapillaryCache(image.getKey(),
 							MapillaryCache.Type.FULL_IMAGE, prev, 200000,
 							200000, new HashMap<String, String>());
-					cache.submit(this, false);
+					imageCache.submit(this, false);
 				} catch (IOException e) {
 					// TODO Auto-generated catch block
@@ -181,9 +194,14 @@
 				}
 			});
-		} else {
+		} else if (data != null){
 			try {
 				BufferedImage img = ImageIO.read(new ByteArrayInputStream(data
 						.getContent()));
-				mapillaryImageDisplay.setImage(img);
+				if (this.mapillaryImageDisplay.getImage() == null)
+					mapillaryImageDisplay.setImage(img);
+				else if (img.getHeight() > this.mapillaryImageDisplay
+						.getImage().getHeight()) {
+					mapillaryImageDisplay.setImage(img);
+				}
 			} catch (IOException e) {
 				// TODO Auto-generated catch block
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java	(revision 31166)
@@ -20,6 +20,11 @@
 import org.openstreetmap.josm.plugins.mapillary.cache.MapillaryCache;
 
-
-
+/**
+ * This is the thread that downloads one of the images that are going to be
+ * exported and writes them in a {@link ArrayBlockQueue}.
+ * 
+ * @author nokutu
+ * @see MapillaryExportManager
+ */
 public class MapillaryExportDownloadThread implements Runnable,
 		ICachedLoaderListener {
@@ -33,5 +38,6 @@
 
 	public MapillaryExportDownloadThread(MapillaryImage image,
-			ArrayBlockingQueue<BufferedImage> queue, ArrayBlockingQueue<MapillaryImage> queueImages) {
+			ArrayBlockingQueue<BufferedImage> queue,
+			ArrayBlockingQueue<MapillaryImage> queueImages) {
 		url = "https://d1cuyjsrcm0gby.cloudfront.net/" + image.getKey()
 				+ "/thumb-2048.jpg";
@@ -64,5 +70,5 @@
 			queue.put(ImageIO.read(new ByteArrayInputStream(data.getContent())));
 			queueImages.put(image);
-			
+
 		} catch (InterruptedException e) {
 			// TODO Auto-generated catch block
@@ -72,6 +78,4 @@
 			e.printStackTrace();
 		}
-
 	}
-
 }
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportManager.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportManager.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportManager.java	(revision 31166)
@@ -14,9 +14,20 @@
 import org.xml.sax.SAXException;
 
+/**
+ * Export main thread. Exportation works by creating a
+ * {@link MapillaryWriterThread} and several
+ * {@link MapillaryExportDownloadThread}. The second ones download every single
+ * image that is going to be exported and stores them in an
+ * {@link ArrayBlockingQueue}. Then it is picked by the first one and written on
+ * the selected folder. Each image will be named by its key.
+ * 
+ * @author nokutu
+ *
+ */
 public class MapillaryExportManager extends PleaseWaitRunnable {
 
 	ArrayBlockingQueue<BufferedImage> queue;
 	ArrayBlockingQueue<MapillaryImage> queueImages;
-	
+
 	List<MapillaryImage> images;
 	String path;
@@ -43,6 +54,6 @@
 	protected void realRun() throws SAXException, IOException,
 			OsmTransferException {
-		Thread writer = new Thread(new MapillaryExportWriterThread(path, queue, queueImages,
-				images.size(), this.getProgressMonitor()));
+		Thread writer = new Thread(new MapillaryExportWriterThread(path, queue,
+				queueImages, images.size(), this.getProgressMonitor()));
 		writer.start();
 		ThreadPoolExecutor ex = new ThreadPoolExecutor(20, 35, 25,
@@ -50,5 +61,6 @@
 		for (MapillaryImage image : images) {
 			try {
-				ex.execute(new MapillaryExportDownloadThread(image, queue, queueImages));
+				ex.execute(new MapillaryExportDownloadThread(image, queue,
+						queueImages));
 			} catch (Exception e) {
 				System.out.println("Exception");
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java	(revision 31166)
@@ -12,5 +12,10 @@
 import org.openstreetmap.josm.plugins.mapillary.MapillaryImage;
 
-
+/**
+ * Writes the images from the queue in the HD.
+ * 
+ * @author nokutu
+ * @see MapillaryExportManager
+ */
 public class MapillaryExportWriterThread implements Runnable {
 
@@ -20,7 +25,9 @@
 	private int amount;
 	private ProgressMonitor monitor;
-	
+
 	public MapillaryExportWriterThread(String path,
-			ArrayBlockingQueue<BufferedImage> queue,ArrayBlockingQueue<MapillaryImage> queueImages, int amount, ProgressMonitor monitor) {
+			ArrayBlockingQueue<BufferedImage> queue,
+			ArrayBlockingQueue<MapillaryImage> queueImages, int amount,
+			ProgressMonitor monitor) {
 		this.path = path;
 		this.queue = queue;
@@ -51,5 +58,5 @@
 				e.printStackTrace();
 			}
-			
+
 			monitor.worked(PleaseWaitProgressMonitor.PROGRESS_BAR_MAX / amount);
 			monitor.setCustomText("Downloaded " + (i + 1) + "/" + amount);
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java	(revision 31166)
@@ -20,9 +20,10 @@
 
 /**
- * This Class downloads all the pictures in a given sequence and creates the
- * needed MapillaryImage and MapillarySequence objects
+ * This thread downloads all the pictures in a given sequence and creates the
+ * needed MapillaryImage and MapillarySequence objects. It just stores the ones
+ * in the given area.
  * 
  * @author nokutu
- *
+ * @see MapillarySquareDownloadManagarThread
  */
 public class MapillarySequenceDownloadThread implements Runnable {
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadManagerThread.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadManagerThread.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadManagerThread.java	(revision 31166)
@@ -14,5 +14,6 @@
  * 
  * @author nokutu
- *
+ * 
+ * @see MapillaryDownloader
  */
 public class MapillarySquareDownloadManagerThread implements Runnable {
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadThread.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadThread.java	(revision 31165)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadThread.java	(revision 31166)
@@ -15,4 +15,10 @@
 import org.openstreetmap.josm.plugins.mapillary.MapillaryImage;
 
+/**
+ * This thread downloads one of the images in a given area.
+ * 
+ * @author nokutu
+ * @see MapillarySqueareDownloadManagerThread
+ */
 public class MapillarySquareDownloadThread implements Runnable {
 	String url;
@@ -32,8 +38,8 @@
 			br = new BufferedReader(new InputStreamReader(
 					new URL(url).openStream()));
-			/*String jsonLine = "";
-			while (br.ready()) {
-				jsonLine += br.readLine();
-			}*/
+			/*
+			 * String jsonLine = ""; while (br.ready()) { jsonLine +=
+			 * br.readLine(); }
+			 */
 			JsonObject jsonobj = Json.createReader(br).readObject();
 			if (!jsonobj.getBoolean("more")) {
@@ -47,6 +53,6 @@
 					image = jsonarr.getJsonObject(i);
 					images.add(new MapillaryImage(image.getString("key"), image
-							.getJsonNumber("lat")
-							.doubleValue(), image.getJsonNumber("lon").doubleValue(), image
+							.getJsonNumber("lat").doubleValue(), image
+							.getJsonNumber("lon").doubleValue(), image
 							.getJsonNumber("ca").doubleValue()));
 				} catch (Exception e) {
