Enclosed some monitoring code in #if MONITORING == 1 tests