Added mutexes and commenting