More improvements to keepalive strategy