Some small refactoring.