Send function corrected, global connections variable added