lightweight trie implementation