ChatGPT - Refactoring Legacy JS Code