Address Dean's comment on trie and improve tests