More refactoring to C qsort