refactor, move common code to TransformerUtils