Assorted cleanup and reorganization.