improvements to script