adding 'asPromise' utility function