Merge early part of branch 'jc/daemon'