Cleaning up the loose ends

Many loose-end projects are marked by comments containing "XXX". Any of those you'd like to tackle are fair game.

Some other things that would be nice: