modefied counting logic