refactor QuickSort