Refactored the code of rehashing
Dispose implemented for hashMap