move trie utilities into their own file