added a templated quicksort