Refactor to use a Transformer abstraction.