You are maintaining a legacy JavaScript codebase that has become difficult to manage due to repeated blocks of similar code across multiple functions. You want to refactor this code to improve readability and maintainability. How can GitHub Copilot help you refactor this code and improve your productivity?