Added an enum representing traversal direction