Refactor hash