Release 0.4.0

Fixes #60 and #75.

Once this is merged I will tag the release, and do the PyPI and Read The Docs uploads.