Some small refactoring and renaming.