Added code for trie