Reverted to before simplifying graph traversal