Added group logic for sets, trying to deal with interior nodes