Cleaned up code for peer.