refactor the rescue