Threading for sending and receiving

*UNTESTED!*