public static ArrayList<Song> download(long time, String userName, ArrayList<Song> songs)
	{
		ArrayList<Song>	allSongs=songs;
		ArrayList<String> dates= new ArrayList<String>();
		ArrayList<String> names= new ArrayList<String>();
		ArrayList<String> artists = new ArrayList<String>();
		Elements dateList;
		Elements nameList;
		Elements artistList;
		String lastDate;
		String user= userName;
		long cutOff=time;
//		String user="rck24";
//		String apiKey="2f8ae0c603413f99dd8e7d92a5bb430c";
		TimeCalculator calc= new TimeCalculator();
		System.out.println("Going to try and download your listening history now.");
		try{
			Document doc= Jsoup.connect("http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&limit=200&user="+user+"&from="+cutOff+"&api_key=2f8ae0c603413f99dd8e7d92a5bb430c").get();
			while(doc.hasText()){
				dateList=doc.getElementsByTag("date");
				nameList=doc.getElementsByTag("name");
				artistList=doc.getElementsByTag("artist");
				
				for(int i=0; i<dateList.size(); i++){
					Element date= dateList.get(i);
					Element name= nameList.get(i);
					Element artist= artistList.get(i);
					
					Node dateUnWrapped= date.unwrap();
					Node nameUnWrapped=name.unwrap();
					Node artistUnWrapped= artist.unwrap();
					
					dates.add(dateUnWrapped.toString());
					names.add(nameUnWrapped.toString());
					artists.add(artistUnWrapped.toString());	
				}
				if(dates.size()>0)
				{
					lastDate=dates.get(dates.size()-1);
					System.out.println(lastDate);
					lastTime=calc.calculte(lastDate);
					String url="http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&limit=200&user="+user+"&from="+cutOff+"&to="+lastTime+"&api_key=2f8ae0c603413f99dd8e7d92a5bb430c";
					doc= Jsoup.connect(url).get();
				}
				
				else
				{
					System.out.println("Error with downloading dates.");
					break;
				}
				
			}
			System.out.println("Finnished downloading your listening history.");
			System.out.println("Now preparing your library.");
			getSongLibrary(allSongs, dates, names, artists);
		} catch(Exception e){
			System.out.println("Last.fm connection error");
			lastTime=time;
		}
		if(dates.size()==0)
		{
			lastTime= time;
		}
			
		return allSongs;
		
		
	}