Some more refactoring