many changes and cleanups and updates to core and daemon libs