Adding Trie support and tests to verify its working