Merge sort implementation