mature cleanup.

adding javadoc for many classes.
refactor class Figures to Figure.
minor changes.