more misc refactoring