Correct version of QuickSort