performance enhancement to SortedMerge