modified angularFire code