You don't have to unset %alerter since you use a local variable. A local variable unsets itself after finishing processing its task.
In fact, I don't see the need for the variable. The script can be shortened as shown to you by gooshie, but you still keep it redundant.