rectified merge sort code