Replace sleep by sleepForTimeInterval