implemented GetSortedLevels