Refactor Node Traversal