Added semaphore for concurrency issues