updated code for oxygen control