fiddling around with middleware ordering

plus some caching stuff in local settings