Added counter and some comments