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 31158)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31159)
@@ -15,9 +15,8 @@
 public class MapillaryData {
 	public volatile static MapillaryData INSTANCE;
-	
+
 	private final List<MapillaryImage> images;
 	private MapillaryImage selectedImage = null;
 	private List<MapillaryImage> multiSelectedImages;
-
 
 	public MapillaryData() {
@@ -169,11 +168,17 @@
 		}
 	}
-	
+
+	/**
+	 * Adds a MapillaryImage object to the list of selected images, (when ctrl +
+	 * click)
+	 * 
+	 * @param image The MapillaryImage object to be added.
+	 */
 	public void addMultiSelectedImage(MapillaryImage image) {
 		this.multiSelectedImages.add(image);
 		Main.map.mapView.repaint();
 	}
-	
-	public List<MapillaryImage> getMultiSelectedImages(){
+
+	public List<MapillaryImage> getMultiSelectedImages() {
 		return multiSelectedImages;
 	}
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 31158)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java	(revision 31159)
@@ -1,4 +1,3 @@
 package org.openstreetmap.josm.plugins.mapillary;
-
 
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -61,5 +60,4 @@
 	}
 
-
 	/**
 	 * Sets the MapillarySequence object which contains the MapillaryImage.
@@ -71,5 +69,4 @@
 		this.sequence = sequence;
 	}
-
 
 	public MapillarySequence getSequence() {
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 31158)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31159)
@@ -1,26 +1,57 @@
 package org.openstreetmap.josm.plugins.mapillary;
 
+import javax.swing.ImageIcon;
+import javax.swing.JMenuItem;
+
+import org.openstreetmap.josm.gui.MainMenu;
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.plugins.Plugin;
 import org.openstreetmap.josm.plugins.PluginInformation;
+import org.openstreetmap.josm.tools.ImageProvider;
 
 /**
  * This is the main class for the mapillary plugin.
+ * 
+ * @author nokutu
  *
  */
-public class MapillaryPlugin extends Plugin{
+public class MapillaryPlugin extends Plugin {
 
-    public MapillaryPlugin(PluginInformation info) {
-        super(info);
-    }
+	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 int ICON_SIZE = 24;
+	
+	MapillaryDownloadAction downloadAction;
+	MapillaryExportAction exportAction;
+	
+	public static JMenuItem DOWNLOAD_MENU;
+	public static JMenuItem EXPORT_MENU;
 
-    /**
-     * Called when the JOSM map frame is created or destroyed.
-     */
-    @Override
-    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-        if (oldFrame == null && newFrame != null) { // map frame added
+	public MapillaryPlugin(PluginInformation info) {
+		super(info);
+		downloadAction = new MapillaryDownloadAction();
+		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);
+		EXPORT_MENU.setEnabled(false);
+
+	}
+
+	/**
+	 * Called when the JOSM map frame is created or destroyed.
+	 */
+	@Override
+	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+		if (oldFrame == null && newFrame != null) { // map frame added
+			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/MapillaryToggleDialog.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java	(revision 31158)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java	(revision 31159)
@@ -35,5 +35,6 @@
  *
  */
-public class MapillaryToggleDialog extends ToggleDialog implements ICachedLoaderListener{
+public class MapillaryToggleDialog extends ToggleDialog implements
+		ICachedLoaderListener {
 
 	public static MapillaryToggleDialog INSTANCE;
@@ -65,5 +66,5 @@
 		return INSTANCE;
 	}
-	
+
 	public static void deleteInstance() {
 		INSTANCE = null;
@@ -99,17 +100,12 @@
 					prev = JCSCacheManager.getCache("mapillary");
 					HashMap<String, String> headers = new HashMap<>();
-					MapillaryCache cache = new MapillaryCache(image.getKey(), MapillaryCache.Type.FULL_IMAGE, prev, 200000, 200000, headers);
+					MapillaryCache cache = new MapillaryCache(image.getKey(),
+							MapillaryCache.Type.FULL_IMAGE, prev, 200000,
+							200000, headers);
 					cache.submit(MapillaryToggleDialog.getInstance(), false);
 				} catch (IOException e) {
 					// TODO Auto-generated catch block
 					e.printStackTrace();
-				} catch (Exception e) {
-					System.out.println("Hello");
 				}
-				/*if (image.getImage() != null) {
-					showImage();
-				} else if (image.getThumbnail() != null) {
-					showThumbnail();
-				}*/
 			} else
 				showDefault();
@@ -156,19 +152,26 @@
 	public void loadingFinished(CacheEntry data,
 			CacheEntryAttributes attributes, LoadResult result) {
-		System.out.println("Listener");
-		try {
-			BufferedImage img = ImageIO.read(new ByteArrayInputStream(data.getContent()));
-			this.remove(active);
-			JLabel label = new JLabel("", new ImageIcon(img), JLabel.CENTER);
-			active = label;
-			this.add(active);
-			this.updateUI();
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+		if (!SwingUtilities.isEventDispatchThread()) {
+			SwingUtilities.invokeLater(new Runnable() {
+				@Override
+				public void run() {
+					updateImage();
+				}
+			});
+		} else {
+			try {
+				BufferedImage img = ImageIO.read(new ByteArrayInputStream(data
+						.getContent()));
+				this.remove(active);
+				JLabel label = new JLabel("", new ImageIcon(img), JLabel.CENTER);
+				active = label;
+				this.add(active);
+				this.updateUI();
+			} catch (IOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
 		}
-			
-		
-		
+
 	}
 }
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java	(revision 31158)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java	(revision 31159)
@@ -55,14 +55,14 @@
 		return new BufferedImageCacheEntry(content);
 	}
-	
+
 	@Override
-    protected boolean isObjectLoadable() {
+	protected boolean isObjectLoadable() {
 		if (cacheData == null)
 			return false;
-        byte[] content = cacheData.getContent();
-        return content != null && content.length > 0;
-    }
+		byte[] content = cacheData.getContent();
+		return content != null && content.length > 0;
+	}
 
-	//@Override
+	// @Override
 	protected boolean handleNotFound() {
 		// TODO Auto-generated method stub
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 31158)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java	(revision 31159)
@@ -2,24 +2,37 @@
 
 import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.HashMap;
 import java.util.concurrent.ArrayBlockingQueue;
 
 import javax.imageio.ImageIO;
 
+import org.apache.commons.jcs.access.CacheAccess;
+import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
+import org.openstreetmap.josm.data.cache.CacheEntry;
+import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
+import org.openstreetmap.josm.data.cache.ICachedLoaderListener;
+import org.openstreetmap.josm.data.cache.JCSCacheManager;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryImage;
+import org.openstreetmap.josm.plugins.mapillary.cache.MapillaryCache;
 
-public class MapillaryExportDownloadThread implements Runnable {
+public class MapillaryExportDownloadThread implements Runnable,
+		ICachedLoaderListener {
 
 	String url;
 	ArrayBlockingQueue<BufferedImage> queue;
 	ProgressMonitor monitor;
+	MapillaryImage image;
 
-	public MapillaryExportDownloadThread(MapillaryImage image, ArrayBlockingQueue<BufferedImage> queue) {
+	public MapillaryExportDownloadThread(MapillaryImage image,
+			ArrayBlockingQueue<BufferedImage> queue) {
 		url = "https://d1cuyjsrcm0gby.cloudfront.net/" + image.getKey()
 				+ "/thumb-2048.jpg";
 		this.queue = queue;
+		this.image = image;
 	}
 
@@ -27,4 +40,9 @@
 	public void run() {
 		try {
+			CacheAccess<String, BufferedImageCacheEntry> prev = JCSCacheManager
+					.getCache("mapillary");
+			new MapillaryCache(image.getKey(), MapillaryCache.Type.FULL_IMAGE,
+					prev, 200000, 200000, new HashMap<String, String>())
+					.submit(this, false);
 			queue.put(ImageIO.read(new URL(url)));
 		} catch (MalformedURLException e) {
@@ -40,3 +58,18 @@
 	}
 
+	@Override
+	public void loadingFinished(CacheEntry data,
+			CacheEntryAttributes attributes, LoadResult result) {
+		try {
+			queue.put(ImageIO.read(new ByteArrayInputStream(data.getContent())));
+		} catch (InterruptedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+	}
+
 }
