Minor refactoring and renaming.