hash refactor