Refactored code to use promise async generator.