Javadoc for the cfg package

And fix some missing tests.