Replacing time.Sleep with sync.WaitGroup