Improved storage of chat history.