refactored hash