Some small refactoring