Small refactorings and javadocs.