replaced for..in statement in recursiveTransformation function