Refactor to introduce support for being able to access a promise