However, by trying out the solutions ChatGPT provided me with, I started understanding the logic behind how this could be achieved. Then finally it clicked and I wrote the whole thing out. Worked absolutely brilliantly. ChatGPT is underrated...