sortFunctions edited for sort by ArrayID