move templating out to new module