added code for groups