update the code to have variable monitoring and polling intervals