Used enumerate for counters

Made the code cleaner