Implemented chat history and made clients shut down gracefully on
disconnect.