adding monitor function