adding in some smarter debuggingx