add number of retries as parameter