Mostly code rearrangement.