Refactor the hash code