Implemented the merge and tidy steps