trees: cleanup trie code