created gcm function