Some refactoring to deal with DecoratorFactory's role in contexts and templates. refs #478