add grouping

not fully implemented yet