Release 0.4.6.

Also some minor refactorings.