improved matcher algo