You clearly have missed the problem, however maybe it's not the case with this stuff, JesusLyf can answer it.I don't see what is so difficult?
If the same spell is casted again, overwrite the first cast with the new one.
Cheers, you're right.In the second example of "AoE (Area of Effect) enumeration", in the function "onEffect" you're using "local group g" which isn't used.