Move count script to separate file