refactored trie_lookup() to use trie_traverse()