move more code to coroutine