Update use of sorting functions