made code even more portable by redefing hash_map appropriately in clustering.h
split patch into two