Added lots of javadoc.