Refactored the Javadoc code and added more unit tests.