optimized and well-commented retransmit_send