slight mods to script