More work and tests for template output.