Revamp heartbeat implementation