Clean up some methods in Trie
Add tests for Trie