Using trie instead of flat list for indexes