more refactoring and class renaming