Added some useful logic
Added default error controller