first shot at coroutines. untested