restructure sortedGatherer