sort the functions