Some minor refactoring.