Add countChange function