public boolean routeGreedy(DataPacket packet)
	{
		if(packet.getForwardMode() == ForwardMode.PERIMETER)
			packet.setForwardMode(ForwardMode.GREEDY);

		Map<PeerAddress, Peer> routingTable1 = agent.getPeers();
		if(routingTable1.size() == 0) {
			Logger.debug("Packet dropped because there are no peers in table to route to.");
			return false;
		}
		
		double d = packet.getDestinationPeer().getLocation().distanceTo(agent.getPeer().getLocation());
		PeerAddress id = agent.getPeer().getAddress();
		
		for (Map.Entry<PeerAddress, Peer> entry : routingTable1.entrySet())
		{
			Peer peerN = entry.getValue();
			double t = peerN.getLocation().distanceTo(packet.getDestinationPeer().getLocation());
			if (peerN.getAddress().equals(packet.getDestinationPeer().getAddress()) || t<d)
			{
				id = peerN.getAddress();
				d = t;
			}
		}
		
		if(id.equals(agent.getPeer().getAddress()))
		{
			Logger.debug("Reached local maximum, switching packet to perimeter mode");
			return routePerimeter(packet);
		}
		
		packet.setHdr_fwd_dst_id(id);
		
		return true;
	}