0.4.rebase

That's pretty much #128, rebased.