implemented retry functionality