Completed work on semaphores

Completed work on semaphores