rewritten trie
made cache for queued values