reading from and writing to firebase