moving the hardcoded script into a js file