add contravariance to sorting methods templates
qsort with improvements