clean up trie generating code