Update signature for next() and raise().
Tidy merge middleware.