Slight changes to per-document grouping.