new script, minor fixes