Replace synchronous code with async code.