refactor player.rb