added counter variable