moved all code to <head>