fixed broken closest() function

I had to put it in reverse order. Mehran! Matches() function. Split it
into a separate module named matched()