Added code for loading chat history and chat logging (disabled).