renamed some variables and modified the send function