Added credit API.
Documented credit API.
Refactored widget tools.