basic grouping function, more detail updated tomorrow