Refactor of template file structure. GA code added.