minor refactoring and renaming