Refactoring and JavaDoc updates to prepare for release.