Better debug out and some mutexes