Iterative Reengineering of Legacy Functions