Refactored the event handling out to a different file.
Added reg/unreg features. Documented the interface to the decorators.