As a slightly alternative solution, there is an option to use not an ArrayList, but a Dictionary. VBS dictionary also has the Exist and Remove functions (personally, I was missing them in a regular Array), but this is still a slightly different way to solve the problem