Doc improvements, some refactorings.