Code cleanup and combined SendQueue and ReceiveQueue