Add sorting to merge files