Various refactorings.