refactor merge sort and add insertion sort