refactored Hash class