replace engine with coroutine