Clean up retry functionality to use for loops rather than while loops. Signed-off-by: Eric Callahan <arksine.code@gmail.com>