removed mutexes and replaced with channels