move script to .js file