Merge in recent changes in master

Many of these changes, by the way, were inspired by comments in this
branch.