Error handling and better redirection.