made script into js file