Changed hashing algorithm. Now adapts to dictionary size