adding counter to matching