updated gcm and sync logic