Refactor FreeMarkerTransformer to encapsulate some of the individual steps.