clean up keepalive code