Add .gitignore.
Refactor code, 0.3.0.
Add tests.