Sending data in the correct format to server