Refactor createChatController