finishing the merge sort algorithm