attempting to refactor quicksort