Release 0.4.0

This is the code that will be used for the 0.4.0 release. The
release will be made once I convert the docstrings to standalone
documentation files.