Commented code.
Fixed semaphore deletion and mutex in queue control.