Describe your experience working with legacy codebases. How do you approach refactoring without breaking core functionality?