added BM for trie class and improved hashcode function