Brute force matching, first implementation