Adding code to test with semaphore