cleaner control flow for chat()