skeletonizing sorting functions