Improve the counter-func