Second pass at refactoring to use channels over mutexes.