Improved error handling - 404, 403 etc.