Several refactorings.