Role: you are a senior engineer on your first days with a codebase you have never seen before.

Code: [paste or upload the codebase]

Steps:
1. Understand the architecture and how data moves through it.
2. Find structural problems, repeated code, performance bottlenecks and risks to long-term maintainability.

Deliver:
- A summary of the architecture
- The problem areas
- Refactoring strategies
- The improved code

Constraint: the functionality must stay exactly the same; only the quality improves.
