Minor refactorings and comments.