move all the JS code in the <head>