Describe a time when you had to refactor a system. What was the process, and what challenges did you face?