Adding the stop function to monitoring