Describe a time when you had to work with a legacy codebase. How did you approach understanding and modifying it?