simplify traversing
add some more documentation