added group logic