Factor out the spin-loop.
De-bozo.
Simplify and correct the maybe-restart-on-error logic.