Started rewrite of event tests
Bugfixes and refactoring