Refactored send_data to use new protocol