refactor NodeFactory