Dynamic match threshold, fixes #2