Minor refactoring in peer.go