Updated hash implementation