Minor code rearrangements.