Refactored WebRTC classes for generality and reliability