move uniq and sort out of merge-block