Add checks and tests
Fixes after code review
Merge pull request #38 from ggirou/checks

Add checks and tests