replaced counter var