Issue #198.  First stage refactoring.