Comments added.
Functions reorganization.
Cosmetic fix.