some further refactoring and renaming