Refactoring Chat class