Improving console output logic