update the script to generate stats.