v0.4.0

Major breaking changes, completely refactored.

Please see the readme for the new API.
Merge branch 'refactor'