cleaned up debug logging implementation