few improvements on the refactor class
few refactorings
replacing node. it is not preserving behavior, but the transformation does work.