Changes related to #38

See discussion on issue #38, and individual commit messages