Refactored game_helper.rb to eliminate duplication