Maintenance work.

Incorporate some results of static code inspection.
More maintenance work.