Refactor

* Use `test-framework` option
* Added tests
* Code style

Fixes #8 and #16.