How do you approach writing clean, maintainable code when working with a legacy codebase that lacks test coverage?