updated send function