clean implementation of matching coefficients