Added semaphore initialization