added a function CopyMatches