connection keepalive + some clean up