sorting is now a function