Added mutexes for thread processing.