updated firebase code