made some changes to format the data to be sent to server