added tree traversal function, has not been tested yet, waiting for tree builder