working but daemon testing needs a refactor