improved send function