Middleware now functioning correctly.