move javscript code to execute in head