added client and fixed send function