added grouping mode switch