small daemon refactor, add spec