Lots of mildly related changes

Let me know what you think and which ones you think are ok to merge. Sorry for the patchbomb