slight mod to script