now using named semaphores - works under OS X
minor changes