Cleanup of monitoring code