Refined middleware def and loading.

middlewares can now be switched on/off with their config/options in
app.config.