added retry mechanism