refactor trie.hpp's loading and building