First version of stats collection script.