Transformer refactor