Refactor TemplateWriter for single page.