Refactor message debug output