refactoring chatManager