implemented mergeSort