updated hash function