Miscellaneous changes

This branch contains some changes which wouldn't justify separate branches. The changes themselves should be clear from the commit messages.