added more java doc and refactored unit tests