simple merge sort function