Continued refactoring prefs_site_run, also updated template js files