adding an example factory with deferred and promise