improve counter implement