ticket3: Middleware is implemented. Tests pass.