Refactoring daemon, in preparation of rebuilding process model.

* Also cleaning up modules a little.
* Adding some ZMQ helper functions.
* Improving client library.