Added semaphores
Added 1ms delay