Maybe just fixed the bidirectional message reading loop? Probably needs debugging, that was way too simple.  A fresh mind can be a great thing.