Lots of javadoc. Fixes #2.