Added events to extension docgen.

Also fixed a few bugs with the function generator.