sort of a merge sort