Refactored Corto code to ensure redirects to error pages are done by controllers