Testing and Refactoring Legacy Code