Events refactor

Trying to fix issue #79 I ended up refactoring events so that they're implemented with variants and adding tests.