Minor changes and bug fixes.
Some javadoc added.