added multi-threading for coefficients matching