Document to Template and first render function