Code for gas monitoring