improved attached group, fixed loop that checks for attaching attached groups