Parsing the sending and receiving endpoints correctly