Improved debug mode