Assorted refactorings.