Added some debugging code tidied things up on the client receive side.