modified controller, model and view to handle multiple errors