modified to read events from the cloud