implement core of trie