updated monitoring code