output logic