Some refactoring, moved firebase reference creation into its own factory