Refactored logic for looping games from main