Implemented several daemon fixes and improvements.

All 149 tests pass.