Merge pull request #216 from jpav/master

Fixes #206 and fixes #203
Fixes #217