Simplify logic in Visual matching