Code for new countbot function.