add more features on chat, and more refactories