ID’s should be single use, not for everything. For everything just use the class.
While running it, open up the console and watch the value of the array. I can assist more when I get home, but work I do not have the tools to work on that type of development.