Added javadocs in most places.