moved the sleep out of the try