Added Peer object, and fixed peer discovery logic.