Remove unused semaphores and commented code.