refactored chat window