Trie implementation by me. Code is a little more nice now.