Creating an observable from a factory function