how does line matching work?