Refactor events and notifications