Improvements to zmq codec and grid example