Refactored hash model. Updated tests.