Minor refactoring and renaming