refactor chat message