Moderately large cleanup, killing a lot of warnings.

No actual changes.