some more refactoring