simplify templating logic