Minor improvements to script.