You're absolutely correct. All I did was copy-paste the code from one of my scripts (explaining the first, second, and last bullet) and change a few details. The other two points are more laziness of mine.
I'll update my code appropriately. Thanks for the comments.