Minor code tidy-up and further preparations for test automation/coverage.