adding callback functions to traversals