added auto retry and made retry wait period random