changed signature of the traversal functions
merged