MainChatController refactoring