More work on pluggable middlewares.