Dynamic resizing of HASH_MAP

More general performance improvements