Moved mergesort and quicksort implementations