Simplified the 'send' operation by moving the connection logic into the code that sets up the send.