Refactor QuickSort