Merge pull request #212 from jpav/master

Fixes #204
Merge pull request #214 from jpav/master

Fixes #186.
Fixes #206 and fixes #203