fixed formatting issue
refactored stats.rb and persistence.rb