Fleshed out implementation of node traversal.