Corrected generateDataToSend