Made a small refactoring of coroutine.