Introduced template

@markewallace - Hi Mark. I moved the JS UI creation code and introduced a template instead.