Refactor master_game