Move trie module to separate file