making the script work in JS