implement trie methods