Small refactor of templating