change the traversal method