Added javadoc and added further tests.