Added Trie, updated code