Some more minor refactoring