Refactoring to support collecting scm stats for different periods.