public boolean download(){
		ArrayList<Peer> peers = tracker.requestPeers(this);

		Peer p = peers.get(0);
		Thread t = new Thread(p);
		System.out.println("new peer: " + p.getIP());
		t.start();
		
		pieceIndex = getNextPiece(p);
		while(running){
			if(pieceIndex >= 0){
				int offset = 0;
				int pLen = pieceLength(pieceIndex);
				int left = pLen;
				int length = Math.min(MAX_PIECE_LENGTH, left);
				int numBlocks = pLen / length;
				if(pLen % length > 0)
					numBlocks++;
				Piece piece = new Piece(numBlocks, pLen);
				int bindex = 0;
				while(left > 0){
					System.out.println("Block reqquested from " + p.getIP() + " - Piece " + pieceIndex + ", Block " + bindex);
					p.requestBlock(pieceIndex, offset, length);
				}
				byte[] data = piece.getData();
				if(data != null)
					file.write(data, torInfo.piece_length * pieceIndex + offset);
			}
			
			/*
			for(Peer p : peers){
				if(!currentPeers.contains(p)){
					currentPeers.add(p);
					Thread t = new Thread(p);
					System.out.println("new peer: " + p.getIP());
					t.start();
					continue;
				}
				if(p.isAlive())
					System.out.println("peer waiting... " + p.getIP() + " - " + p.isAlive() + " - " + p.isBusy());
				if(p.isAlive() && !p.isBusy()){
					pieceIndex = getNextPiece(p);
					if(pieceIndex >= 0){
						Piece piece = this.getPiece(pieceIndex);
						if(piece == null){

							int pLen = pieceLength(pieceIndex);
							int numBlocks = pLen / MAX_PIECE_LENGTH;
							if(pLen % MAX_PIECE_LENGTH > 0)
								numBlocks++;
							piece = new Piece(numBlocks, pLen);
							save(piece, pieceIndex);
						}
						int blockid = piece.getNextBlock();
						if(blockid >= 0)
							continue;
						int length = 0;
						if(blockid == piece.numBlocks() - 1)
							length = Math.min(MAX_PIECE_LENGTH, piece.getLength() % MAX_PIECE_LENGTH);
						if(length == 0)
							length = MAX_PIECE_LENGTH;
						p.requestBlock(pieceIndex, blockid * MAX_PIECE_LENGTH, length);
					}
				}
			}
			*/
		}
		
		
		if(error_death)
			return false;
		
		return true;
	}