assorted refactoring