refactored peer connection