move 'sending packet' logic to other member functions