Some refactorings.