Refactoring. Transformer factory with cache of transformers.