Merge pull request #168 from jpav/master

Fixes #149
Fixes #173.