refactoring transLeaf