Issue #11: further work and refactoring