The inhaled oxygen passes into and through the alveoli and is diffused through the capillaries into the arterial blood. Meanwhile, the waste-rich blood from the veins releases the carbon dioxide into the alveoli. The carbon dioxide then follows the same path out of the lungs when exhaling. The principle functions of the respiratory system to ventilate the lungs, to extract oxygen from the air and transfer it to the bloodstream, to excrete carbon dioxide as well as water vapor, to maintain the acid base of the blood