Small error in that code...
{score1 = score1 + score _x;} forEach (units grp1A + [units grp1B]);
should be:
{score1 = score1 + score _x;} forEach (units grp1A + units grp1B);
(otherwise you would be doing something like [fred, john] + [[terry, alan]] => [fred, john, [terry, alan]]).