add mutexes and stuff