Made modifications for SortMergeJoin