Simplifying the document event generation down to a single, generic function.  Simplifying event handlers and fixing some output errors in style.py.