tried to universalize the data sending process