removed redundant counter var.