add matching algorithm