Fixes issue #117
Add tests
Merge pull request #118 from reubano/patch-1

Fixes issue #117