A method for controlling the delivery of a breathing gas to a patient. The method comprises: delivering a flow of breathing gas to a patient, the breathing gas having a breathing gas flowrate and a fraction of inspired oxygen measuring an oxygen saturation level of the patient determining a respiratory rate of the patient automatically adjusting the fraction of inspired oxygen of the breathing gas based on the measured oxygen saturation level of the patient and a breathing gas flowrate set-point and automatically adjusting the breathing gas flowrate set-point based on the determined respiratory rate of the patient.