Mostly minor code reformatting.
Some rearrangements.