You're right on both accounts. I seem to have a slight obsession with using halt :P

I tested it and found the error in my script, which was that the $2- should be $1-, but it does work.

Still think yours is better, runs the routine faster and more accurately than mine.