moved script to js