Subjects undergoing elective ERCP and EUS will receive standard monitoring and sedation. In addition, capnography which measures carbon dioxide levels and can graphically assess respiratory activity will be used. Subjects will be randomized to either a capnography blinded or titration arm. In the capnography titration arm, the endoscopy team would be made aware of capnographic abnormalities as they arise throughout the procedure. In the capnography blinded arm, this information will not be available to the endoscopy team and represents standard of care. It is our hypothesis that using capnography can prevent low oxygen levels known as hypoxemia, during these procedures. The primary outcome of our study is the proportion of patients with hypoxemia in the two arms. Review of the literature indicates that the incidence of hypoxemia without supplemental oxygen varies from 30-70%. Our sample size calculation is based on a reduction of the hypoxemia incidence from 40% to 20%. Secondary outcomes will be the proportions of patients with oxygen requirements, major hypoxemia and apnea (lack of respiratory activity via capnography for at least 15 seconds) in the two arms. We will perform a univariable and multivariable analysis to determine the risk factors for apnea.