Simplify middleware a bit
Clean up
Use ActionView as template
Only show error page if the request is non-XHR