@SuppressWarnings("unchecked")
	public ArrayList<Peer> update(String event, Manager manager) {
		this.event = event;
		
		if(this.event.equals("started")){
			try {
				manager.getUpload();
				
			} catch (IOException e) {
				this.downloaded = 0;
				this.uploaded = 0;
			}
		} else {
			manager.setDownloadUpload(this.downloaded, this.uploaded);
		}

		this.requestString = createURL(this.announce);
		
		HashMap<ByteBuffer, Object> response = null;

		try {
			byte[] trackerResponse = sendGETRecieveResponse();

			if (trackerResponse == null) {
				log.severe("Error communicating with tracker");
				return null;
			}
			response = (HashMap<ByteBuffer, Object>) Bencoder2.decode(trackerResponse);
		} catch (BencodingException e1) {
			log.severe("Error decoding tracker response");
			return null;
		}

		if (response.containsKey(KEY_FAILURE)) {
			log.severe("Failure from the tracker.");
			return null;
		}

		ArrayList<Peer> peers = new ArrayList<Peer>();

		this.interval = (Integer)response.get(KEY_INTERVAL);

		List<Map<ByteBuffer, Object>> peersList = (List<Map<ByteBuffer, Object>>) response
				.get(KEY_PEERS);

		if (peersList == null) {
			log.severe("List of peers given by tracker is null");
			return null;
		}

		for (Map<ByteBuffer, Object> rawPeer : peersList) {
			int peerPort = ((Integer) rawPeer.get(KEY_PORT)).intValue();
			byte[] peerId = ((ByteBuffer) rawPeer.get(KEY_PEERID)).array();
			String ip = null;
			try {
				ip = new String(((ByteBuffer) rawPeer.get(KEY_IP)).array(),
						"ASCII");
			} catch (UnsupportedEncodingException e) {
				log.severe("Unable to parse encoding");
				continue;
			}

			peers.add(new Peer(peerId, peerPort, ip, manager));
		}

		if(this.interval < 0){
			this.interval = 120000;
		}
		
		log.fine("Converted: " + peers);
		return peers;
	}