match algo implemented