cleaned up hmac code