lots of changes to templating