[Chat] - Refactor code.