Moved mutex variables to global