Moving lots of code around, creating factory classes for TemplateOutputFiles