added break to stop retrying after success
fixed a few small issues