refactor hal daemon