Improvements for #33

Contains some improvements to the pull-request #33.