Updates to semaphore implementation