refactoring respond_and_redirect_to