refactored text output for better debugging