A tiny bit more refactoring and cleanup.