Refactor and cleanup. Rename to Trie.