Events refactoring and support for modifying data in EventArgs

This supersedes #98 and fixes #94.