Final semaphore version