Removed extraneous code, optimized SleepForDuration method