more refactoring and renaming