implemented the ACK function for communication