Added logic to determine next game