added more javadoc and unit tests