rewrite script.js