Add threads and mutexes