Use functions as a sorting mechanism