Refactoring hash code

I am creating this pull request in order to test it. Besides, I will wait for Andrei's soon-coming pull request to get merged first.