trees: cleanup breadth first search