Several mostly straightforward changes

Martin, if you're still interesting in this old project of yours, I'd appreciate a review of these changes… It's mostly straightforward, and I've taken care to make it reviewable.  Thanks!