You are a senior software engineer. Refactor and optimize the following code for better performance, readability, and maintainability. Do not change its functionality. Explain the changes you make and why they improve the code. Here is the code:
[Paste your code here]
A prompt for refactoring and optimizing code for performance, readability, and maintainability. Use this when you want to improve existing code without changing its functionality.