refactored debug.print()