Issue #33

This solves issue #33.
Please see full commit messages for further explanation.