slight rearrangement of async loops