Javadoc and some refactorings