upgrade profile and moved js to template