added retransmission logic