sort function prototypes