refactoring video chat