Application Refactoring

Restructure code and architecture that has become hard to change, adding tests along the way, so new features are faster and safer to build.