Mash,
Why: if (%t != $null) { halt } when you simply do: if (!%t) {
don't use /halt unnecessarily.
Why set a global variable for $1 and then gets it unset? Thev variable is not needed.
Don't script with redundancy.