Used OpenAI ChatGPT to do the bulk of this, and then fixed some formatting and looked for obvious mistakes.