replace sleep(0) with yield()