changed semaphore so as not to look at threads