Reimplement keepalive logic