replacing flat list of links with groups of links. links sort by clicks within the group and groups sort by total clicks of their links