Minor improvement of javadoc and several code cleanups.