added the chat model, documented the code