moved js out of templates, moved css and js links into right places in page