refactored the peer-connection stuff