converted delay from Thread.Sleep to Task.Delay and pulled creation of delay to a single method