module pattern for Chat class and chat UI