finished quicksort implementation