Added logic to retry upload in the even that something fails