fixed typing, adjusted scope, added comment to script