minor refactoring, and renaming.