Small changes
Reimplemented SingletonChan with a semaphore.

Considerably simpler.