Refactor and add tests.
Merge pull request #2 from Aigeruth/v0.2.0

Refactor and tests.