handle retries and timeouts better; also added heartbeat keepalives every 20 seconds