traversal code