Refactoring HMMExtract.