Large refactoring to integrate with zmq and separate the app into separate processes.