Refactored plugin event subscription.