Refactor chat

@dschlitt  @pnguyen1097 Ready for review :+1: