Use more templates, instead of inline templating