Added trie logic that should have been added earlier.