I replaced a Chan for a TChan to avoid some problems with concurrency.