Add javadoc and comments