Restructured for lib and daemon