add grouping mechanism, but not tested yet