Implemented toggleChat function