Add javadoc and slight changes