add stats.rb and stats_spec.rb