Use dispatch_semaphore instead of dispatch_group