Refactored test event hooks