Added semaphore lock to service