Cosmetic changes according to Simon’s comments.
Simplified counter expressions.
Fixed hash table initialization.

It was overflowing.