refactor CHR