made some debug output optional