Added if statement to check for $groupData before looping