Minor changes and refactorings.