move script to js