refactor into trie services