Some mixed refactoring.