added grouping by doc type