Added output logic.