refactor traverse and search methods
prefix_search