modified to use -m 1 switch to match on only one instance and exit