move script to main.js