Add check for depth in NodeFactory