code cleanup.
Comments added.