Added Trie class and most of the functions needed to use it