Total rewrite of the control flow.