Added formal source generators.

Bugfixes. Added logging.