Several improvements to the chat util