Added hmac security and minfixes