added quicksort in a functional way