Prepare v0.4.0.
Update unit tests, typos, etc.