Replace continuations with a foreach.