clean up send function