add heartbeat related code.