improve hash table logic