Updated db.findMatches query
Updated database functions. Still very slow.