Richard Otap's thesis code http://goo.gl/uB8orO , rewritten for CZMQ