Changing traversal algorithm