Refactoring and preparing to add time messages to chat.