Added management of which template to use