Please refactor the following code:

```{{language}}
{{code}}
```

Goals:
- Improve readability
- Reduce complexity
- Apply best practices
- Maintain functionality
