updated version with ack-receiving