Re-read the output registration, it would work, but the script still barely makes sense.
You created the same function twice, to do two different things, and even took out some necessary functionality, just so you can scale it on all 3 axis (pretty useless feature).