first working version with Firebase code