[cvs-nhc98] patch applied (hat): Refactor hat-detect: use named fields in the state instead of a