Walk through how you would refactor a legacy, tightly coupled codebase to make it highly testable and modular.