added debug code - fix the match_score algorithm