@SuppressWarnings("unchecked")
	private ArrayList<Peer> getPeerList(byte[] httpResponseByteArray) throws BencodingException 
	{   
		ArrayList<Peer> onlinePeers = new ArrayList<Peer>();
		//extract dictionary from byte[]
		Map<ByteBuffer,Object>  				map = (Map<ByteBuffer,Object>)Bencoder2.decode(httpResponseByteArray);
		String                                  peerIp;
		byte[]                                  peerId;
		int                                     peerPort;
		ByteBuffer                              byteArrayObject;

		//check if tracker has failed
		//cannot recover, must exit
		if (map.get(RUBTConstants.KEY_FAILURE_REASON) != null)
		{
			RUBTConstants.main_log.severe("tracker failed to get response"); 
			System.exit(0);
		}
		//extract interval from dictionary
		this.interval = Integer.parseInt(map.get(RUBTConstants.KEY_INTERVAL).toString());
		//extract min interval from dictionary, if specified
		//else it is half the interval
		if (map.get(RUBTConstants.KEY_MIN_INTERVAL).toString() != null)
		{
			this.min_interval = Integer.parseInt(map.get(RUBTConstants.KEY_MIN_INTERVAL).toString());
		}
		else
		{
			RUBTConstants.main_log.info("Tracker hasnt provided min_interval"); 
			this.min_interval = this.interval / 2;
		}	
		//		System.out.println("Tracker stats: ");
		//		System.out.println("Complete: " + Integer.parseInt(map.get(RUBTConstants.KEY_COMPLETE).toString()));
		//		System.out.println("Downloaded: " + Integer.parseInt(map.get(RUBTConstants.KEY_DOWNLOADED).toString()));
		//		System.out.println("Incomplete: " + Integer.parseInt(map.get(RUBTConstants.KEY_INCOMPLETE).toString()));
		//		System.out.println("interval is " + this.interval + " secs");
		//		System.out.println("min interval is " + this.min_interval + " secs");


		//extract onlinePeers list from dictionary
		ArrayList<Map<ByteBuffer,Object>> list = (ArrayList<Map<ByteBuffer,Object>>) map.get(RUBTConstants.KEY_PEERS);
		//extract onlinePeers from list
		for (Map<ByteBuffer,Object> item:list)
		{
			byteArrayObject = (ByteBuffer)item.get(RUBTConstants.KEY_PEER_IP);
			if(byteArrayObject == null) 
				throw new BencodingException("Could not extract peer ip");

			try{
				peerIp = new String(byteArrayObject.array(), "ASCII");
			}
			catch(UnsupportedEncodingException uee){
				throw new BencodingException(uee.getLocalizedMessage());
			}

			byteArrayObject = (ByteBuffer)item.get(RUBTConstants.KEY_PEER_ID);
			if (byteArrayObject == null) 
				throw new BencodingException("Could not extract peer ID");
			else
				peerId = byteArrayObject.array();

			peerPort = (Integer)item.get(RUBTConstants.KEY_PEER_PORT);

			//Add peer only if not in the list
			if (!client_info.isConnect_to_all() && !RUBTConstants.RUBT_PEERS_IPS.contains(peerIp))
			{
				//ignore peer if peer not RUBT and connect_to_all is not set
				continue;
			}
			Peer newPeer = new Peer(peerIp,peerId,peerPort,this.client_info.getNumber_of_pieces(), this.client_info.isDebug_mode());
			onlinePeers.add(newPeer);
		}  
		return onlinePeers;
	}