Middleware events.