code cleanup and slight improvement
Python's hashed dictionaries implementation