rewrote to send data in chunks.