Merge dev into master

The dev branch is now, I'm quite sure, sufficiently neat and working enough to merge into the master branch.