sorting by user-defined comparison function
Merge branch 'sort-improve'