Add heartbeat monitoring logic