tests refactoring and event system fixes