add if statement to groups