Templating and further tweaks