combined all monitor code into one module