Rearranges base template and moves js back into head.