Implemented factory for firebase