working semaphore
cleanup