optimize the chatbox