Various small fixes and cleanup.
More fixes and cleanup.