make the number of tries an optional keyword argument