Middleware start and end events