add group logic