completed trie functions and doing stage 1