Speedup: use vec instead of TrieMap.