code gardening
fold retry loop into main loop