added better merge sort impl