working solution for count change but too slow