public static Image getSC2MImageCache(String SC2M_WEB_PATH, String loc){
		Image image = null;
		String defaultAva = "images/styles/DarkCore/misc/unknown.gif";
		if(loc == null){loc = defaultAva;}
		else if(loc.equals("null")){loc = defaultAva;}
		else if(loc.equals("")){loc = defaultAva;}
		//loc = "cache/"+loc;
		//File file = new File(System.getProperty("user.dir") + File.separator +loc);
		File file = new File(System.getProperty("user.dir") + "/cache/" +loc);
		//check if file exists
		if(file.isFile() && file.canRead()){
			try {
				//load the file
				//System.out.println("Found file...loading");
				image = ImageIO.read(file);
			}
			catch (IOException e) {
				e.printStackTrace();
			}
		}
		else{
			//if file doesnt exist
			try {
				//load from web
				URL url = new URL(SC2M_WEB_PATH+loc);
				image = ImageIO.read(url);
			}
			catch (Exception e) {
				System.out.println(SC2M_WEB_PATH+loc);
				e.printStackTrace();
				file = new File(System.getProperty("user.dir") + File.separator + "/cache/" + defaultAva);
				try {
					image = ImageIO.read(file);
				}
				catch (Exception e1) {
					e1.printStackTrace();
				}
			}
			try {
				//save to cache
				//System.out.println("Loaded from web..saving to disk");
				file.getParentFile().mkdirs();
				ImageIO.write( (RenderedImage) image, getImageFormat(loc), file);
			}
			catch (Exception e) {
				e.printStackTrace();
			}
		}
		return image;
	}