re-design hash function