Reimplement CountNP, move prep_ta and prep_minn to ResMlt