Lots of cleanup and adding of JavaDocs.