implemented hashing and histograming in one go