logging, javadoc and comments improved