refactored debug mode
refactored debug mode
debug mode improved