Implemented the transformation phase of task 3.