adding most of the javadoc