Assorted bits of refactoring