Updating after refactor.
Middleware fixes.