Improve daemon and tests