hash basics refactor