implement merge sort