Modified code to work for more leagues