The concern is with the script's variables colliding with those in the outer scope. Pushing it to its own method sounds good :)