I think that for the on/off system for the trigger you could just check whether the unit group is empty or not after you remove the unit from it. That makes the timer system unnecessary and also removes the need for condition for the looping trigger.
Also check the tooltip. Use |n to change a line, don't use spaces.