refactor quicksort to use filter instead of list comprehension