OpenAI interview question

Refactor some chat bot code