Fine tune sortGroups method in SortTool class