various tweaks, javadoc, minor optimizations.