adding script and minor fixes