Reduce algorithm complexity
Add option to exclude zero counts for unmatched states