Adding trie function and structure