Do sort on sortedtable to preserve grouping