Add sortByName in functions